mirror of
https://gitee.com/chinware/atomui.git
synced 2024-12-02 11:57:42 +08:00
24 lines
587 B
C#
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;
|
|
}
|
|
}
|
|
} |