feat: add demo, sync theme from scope.

This commit is contained in:
rabbitism
2024-02-06 22:06:52 +08:00
parent 5f35f574a9
commit b297b3f5aa
8 changed files with 124 additions and 6 deletions

View File

@@ -0,0 +1,26 @@
<UserControl xmlns="https://github.com/avaloniaui"
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:u="https://irihi.tech/ursa"
mc:Ignorable="d" d:DesignWidth="800"
d:DesignHeight="450"
x:Class="Ursa.Demo.Pages.ThemeTogglerDemo">
<Grid ColumnDefinitions="Auto, *">
<StackPanel Grid.Column="0">
<TextBlock Text="Global"></TextBlock>
<u:ThemeToggleButton/>
<TextBlock Text="Target To Scope"></TextBlock>
<u:ThemeToggleButton TargetScope="{Binding #scope}"></u:ThemeToggleButton>
</StackPanel>
<ThemeVariantScope Grid.Column="1" Name="scope" RequestedThemeVariant="Dark">
<Border Theme="{DynamicResource CardBorder}">
<StackPanel>
<Button Content="Hello World"></Button>
<Calendar></Calendar>
<u:ThemeToggleButton></u:ThemeToggleButton>
</StackPanel>
</Border>
</ThemeVariantScope>
</Grid>
</UserControl>

View File

@@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Ursa.Demo.Pages;
public partial class ThemeTogglerDemo : UserControl
{
public ThemeTogglerDemo()
{
InitializeComponent();
}
}