Files
FT479/WPFWCSDemo/Views/Settings/SkinView.xaml
2026-06-29 14:46:32 +08:00

59 lines
2.9 KiB
XML

<Page x:Class="WPFWCSDemo.Views.Settings.SkinView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mdColors="clr-namespace:MaterialDesignColors;assembly=MaterialDesignColors"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:WPFWCSDemo.Views.Settings"
xmlns:converters="clr-namespace:WPFWCSDemo.Common.Converters"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="1500"
Title="SkinView">
<Page.Resources>
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
<DataTemplate x:Key="SwatchColorTemplate" DataType="{x:Type Color}">
<Button Width="40"
Height="40"
Background="{Binding Converter={StaticResource ColorToBrushConverter}}"
Command="{Binding DataContext.ChangeHueCommand, RelativeSource={RelativeSource AncestorType=local:SkinView}}"
CommandParameter="{Binding}">
</Button>
</DataTemplate>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="700" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Margin="10">
<TextBlock Text="浅色"/>
<ToggleButton Margin="8 0" Command="{Binding }" IsChecked="{Binding IsDarkTheme}"/>
<TextBlock Text="深色"/>
</StackPanel>
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<ItemsControl ItemsSource="{Binding Swatches}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type mdColors:ISwatch}">
<StackPanel Orientation="Horizontal" Margin="10,0">
<TextBlock Width="90" VerticalAlignment="Center" Text="{Binding Name, Mode=OneTime}" />
<ItemsControl ItemTemplate="{StaticResource SwatchColorTemplate}" ItemsSource="{Binding Hues, Mode=OneTime}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Page>