blob: 34a89e046495e8b1a790c7ef3a3c22643a8e094a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Interactivity;
namespace Godosa.Desktop;
public static class Buttons
{
/// <summary>Presses a button as a click would: toggles a ToggleButton, else raises Click.</summary>
public static void Press(Button button)
{
if (button is ToggleButton toggle) toggle.IsChecked = toggle.IsChecked != true;
else button.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
}
}
|