fix: support WASM.

This commit is contained in:
Zhang Dian
2023-07-19 21:59:43 +08:00
parent e20b1ebc22
commit d1d7987847
6 changed files with 113 additions and 91 deletions

View File

@@ -0,0 +1,24 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Styling;
namespace Ursa.Demo.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;
}
}
}