mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-29 04:33:22 +08:00
feat: add header for demo.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Styling;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Views;
|
||||
|
||||
@@ -8,4 +11,14 @@ public partial class MainView : UserControl
|
||||
{
|
||||
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.Default : ThemeVariant.Dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user