atomui/samples/AtomUI.Demo.Desktop/ShowCase/RadioButtonShowCase.axaml.cs
2024-09-10 12:46:41 +08:00

35 lines
966 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;
}
}
}