atomui/samples/AtomUI.Demo.Desktop/ShowCase/RadioButtonShowCase.axaml.cs
2024-07-30 10:14:09 +08:00

33 lines
903 B
C#

using Avalonia.Controls;
namespace AtomUI.Demo.Desktop.ShowCase;
public partial class RadioButtonShowCase : UserControl
{
protected List<string> CheckRadios { get; set; }
public RadioButtonShowCase()
{
CheckRadios = new List<string>()
{
"ToggleDisabledRadioUnChecked",
"ToggleDisabledRadioChecked"
};
InitializeComponent();
}
public static void ToggleDisabledStatus(object arg)
{
var btn = (arg as Button)!;
var stackPanel = btn.Parent as StackPanel;
var radioBtn1 = stackPanel?.FindControl<RadioButton>("ToggleDisabledRadioUnChecked");
var radioBtn2 = stackPanel?.FindControl<RadioButton>("ToggleDisabledRadioChecked");
if (radioBtn1 != null) {
radioBtn1.IsEnabled = !radioBtn1.IsEnabled;
}
if (radioBtn2 != null) {
radioBtn2.IsEnabled = !radioBtn2.IsEnabled;
}
}
}