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

24 lines
587 B
C#

using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Styling;
namespace AtomUI.Demo.Desktop.Views;
public partial class MainView : UserControl
{
public MainView()
{
InitializeComponent();
}
private void ToggleButton_OnIsCheckedChanged(object sender, RoutedEventArgs e)
{
var app = Application.Current;
if (app is not null)
{
var theme = app.ActualThemeVariant;
app.RequestedThemeVariant = theme == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark;
}
}
}