2024-11-27 19:20:22 +08:00

142 lines
7.6 KiB
XML

<UserControl
x:Class="Semi.Avalonia.Demo.Pages.PaletteDemo"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Semi.Avalonia.Demo.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:Semi.Avalonia.Demo.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="viewModels:PaletteDemoViewModel"
mc:Ignorable="d">
<Design.DataContext>
<viewModels:PaletteDemoViewModel />
</Design.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="../Themes/ToggleSwitch.axaml" />
<ResourceInclude Source="../Controls/ColorItemControl.axaml" />
<ResourceInclude Source="../Controls/ColorDetailControl.axaml" />
<ResourceInclude Source="../Controls/FunctionalColorGroupControl.axaml" />
<ResourceInclude Source="../Controls/ShadowGroupControl.axaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<SplitView
Name="splitView"
CompactPaneLength="50"
DisplayMode="CompactInline"
IsPaneOpen="{Binding #toggle.IsChecked, Mode=TwoWay}"
OpenPaneLength="300"
PanePlacement="Right">
<SplitView.Pane>
<StackPanel>
<ToggleSwitch
Name="toggle"
HorizontalAlignment="Right"
IsChecked="True"
Theme="{DynamicResource SplitViewToggleSwitch}" />
<Border IsVisible="{Binding #splitView.IsPaneOpen}" Theme="{DynamicResource CardBorder}">
<Panel>
<TextBlock
IsVisible="{Binding SelectedColor, Converter={x:Static ObjectConverters.IsNull}}"
Text="Click on Color to Check Details"
TextWrapping="Wrap" />
<controls:ColorDetailControl
Background="{Binding SelectedColor.Brush}"
ColorResourceKey="{Binding SelectedColor.ColorResourceKey}"
IsVisible="{Binding SelectedColor, Converter={x:Static ObjectConverters.IsNotNull}}"
ResourceKey="{Binding SelectedColor.ResourceKey}"
ResourceName="{Binding SelectedColor.ColorDisplayName}" />
</Panel>
</Border>
</StackPanel>
</SplitView.Pane>
<SplitView.Content>
<ScrollViewer>
<StackPanel Margin="8,0">
<TextBlock
Classes="H3"
Text="Basic Colors"
Theme="{DynamicResource TitleTextBlock}" />
<TabControl>
<TabItem Header="Light">
<ItemsControl Margin="16" ItemsSource="{Binding LightLists}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="viewModels:ColorListViewModel">
<ItemsControl Margin="4,0" ItemsSource="{Binding Color}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="viewModels:ColorItemViewModel">
<controls:ColorItemControl
Background="{Binding Brush}"
ColorName="{Binding ColorDisplayName}"
Foreground="{Binding TextBrush}"
Hex="{Binding Hex}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</TabItem>
<TabItem Header="Dark">
<ItemsControl Margin="16" ItemsSource="{Binding DarkLists}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="viewModels:ColorListViewModel">
<ItemsControl Margin="4,0" ItemsSource="{Binding Color}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="viewModels:ColorItemViewModel">
<controls:ColorItemControl
Background="{Binding Brush}"
ColorName="{Binding ColorDisplayName}"
Foreground="{Binding TextBrush}"
Hex="{Binding Hex}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</TabItem>
</TabControl>
<ItemsControl ItemsSource="{Binding FunctionalColors}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:FunctionalColorGroupControl
Title="{Binding Title}"
DarkColors="{Binding DarkColors}"
LightColors="{Binding LightColors}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl ItemsSource="{Binding Shadows}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:ShadowGroupControl
Title="{Binding Title}"
DarkShadows="{Binding DarkShadows}"
LightShadows="{Binding LightShadows}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
</SplitView.Content>
</SplitView>
</UserControl>