Browse Source

Requested change.

pull/1265/head
José Pedro 9 years ago
parent
commit
3f9a79d82d
No known key found for this signature in database GPG Key ID: B8247B9301707B83
  1. 1
      samples/ControlCatalog/Pages/RadioButtonPage.xaml
  2. 11
      src/Avalonia.Controls/Primitives/ToggleButton.cs

1
samples/ControlCatalog/Pages/RadioButtonPage.xaml

@ -12,6 +12,7 @@
Gap="16">
<RadioButton IsChecked="True">Option 1</RadioButton>
<RadioButton>Option 2</RadioButton>
<RadioButton IsChecked="{x:Null}">Option 3</RadioButton>
<RadioButton IsEnabled="False">Disabled</RadioButton>
</StackPanel>
<StackPanel Orientation="Vertical"

11
src/Avalonia.Controls/Primitives/ToggleButton.cs

@ -48,7 +48,16 @@ namespace Avalonia.Controls.Primitives
protected virtual void Toggle()
{
IsChecked = IsChecked.HasValue ? (IsChecked.Value ? (IsThreeState ? (bool?)null : false) : true) : false;
if (IsChecked.HasValue)
if (IsChecked.Value)
if (IsThreeState)
IsChecked = null;
else
IsChecked = false;
else
IsChecked = true;
else
IsChecked = false;
}
}
}

Loading…
Cancel
Save