diff --git a/demo/Semi.Avalonia.Demo/Pages/ThemeVariantDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/ThemeVariantDemo.axaml index 7303773..6f5bcf9 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ThemeVariantDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/ThemeVariantDemo.axaml @@ -4,18 +4,36 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:vm="clr-namespace:Semi.Avalonia.Demo.Pages" + x:DataType="vm:ThemeVariantDemoViewModel" d:DesignHeight="450" d:DesignWidth="800" mc:Ignorable="d"> - - + + + + + + + + + + + + + - - - + + \ No newline at end of file diff --git a/demo/Semi.Avalonia.Demo/Pages/ThemeVariantDemo.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/ThemeVariantDemo.axaml.cs index 2d80dd9..ad7366f 100644 --- a/demo/Semi.Avalonia.Demo/Pages/ThemeVariantDemo.axaml.cs +++ b/demo/Semi.Avalonia.Demo/Pages/ThemeVariantDemo.axaml.cs @@ -1,8 +1,7 @@ -using Avalonia; +using System.Collections.Generic; using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.Markup.Xaml; using Avalonia.Styling; +using CommunityToolkit.Mvvm.ComponentModel; namespace Semi.Avalonia.Demo.Pages; @@ -11,10 +10,22 @@ public partial class ThemeVariantDemo : UserControl public ThemeVariantDemo() { InitializeComponent(); + this.DataContext = new ThemeVariantDemoViewModel(); } +} - private void Switch_OnIsCheckedChanged(object sender, RoutedEventArgs e) - { - scope.RequestedThemeVariant = scope.ActualThemeVariant == ThemeVariant.Dark ? ThemeVariant.Light : ThemeVariant.Dark; - } +public partial class ThemeVariantDemoViewModel : ObservableObject +{ + [ObservableProperty] private ThemeVariant? _selectedThemeVariant; + + public IEnumerable ThemeVariants => + [ + ThemeVariant.Default, + ThemeVariant.Light, + ThemeVariant.Dark, + SemiTheme.Aquatic, + SemiTheme.Desert, + SemiTheme.Dust, + SemiTheme.NightSky, + ]; } \ No newline at end of file