José Pedro
9 years ago
No known key found for this signature in database
GPG Key ID: B8247B9301707B83
2 changed files with
11 additions and
1 deletions
-
samples/ControlCatalog/Pages/RadioButtonPage.xaml
-
src/Avalonia.Controls/Primitives/ToggleButton.cs
|
|
|
@ -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" |
|
|
|
|
|
|
|
@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|