feat: improve demo.

This commit is contained in:
rabbitism
2024-02-23 19:06:53 +08:00
parent 791269a34e
commit cf52bcf2d4
2 changed files with 138 additions and 29 deletions

View File

@@ -26,6 +26,8 @@
</Setter>
</ControlTheme>
<ControlTheme x:Key="{x:Type u:ToolBar}" TargetType="u:ToolBar">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="ItemsPanel">
<ItemsPanelTemplate>
<u:ToolBarPanel />
@@ -45,27 +47,30 @@
Margin="8,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{DynamicResource SemiColorText2}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
DockPanel.Dock="Left"
Foreground="{DynamicResource SemiColorText2}"
IsVisible="{TemplateBinding Header,
Converter={x:Static ObjectConverters.IsNotNull}}" />
<Panel Name="PART_PopupButtonPanel" DockPanel.Dock="Right">
<ToggleButton
Name="button"
IsVisible="False"
Padding="8,0"
VerticalAlignment="Stretch"
IsVisible="False"
Theme="{DynamicResource ToolBarExpandToggleButton}">
<PathIcon Name="PART_Icon" Height="16" Data="{DynamicResource ToolBarHorizontalMoreGlyph}"></PathIcon>
<PathIcon
Name="PART_Icon"
Height="16"
Data="{DynamicResource ToolBarHorizontalMoreGlyph}" />
</ToggleButton>
<Popup
IsLightDismissEnabled="True"
IsOpen="{Binding #button.IsChecked, Mode=TwoWay}"
Placement="{TemplateBinding PopupPlacement}"
PlacementTarget="{Binding #button}">
<Border Theme="{DynamicResource CardBorder}" Padding="2">
<Border Padding="2" Theme="{DynamicResource CardBorder}">
<StackPanel Name="{x:Static u:ToolBar.PART_OverflowPanel}" />
</Border>
</Popup>
@@ -84,41 +89,47 @@
<Style Selector="^[Orientation=Vertical]">
<Setter Property="PopupPlacement" Value="RightEdgeAlignedTop" />
<Style Selector="^ /template/ ContentPresenter#PART_Header">
<Setter Property="DockPanel.Dock" Value="Top"></Setter>
<Setter Property="DockPanel.Dock" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Margin" Value="0 8" />
</Style>
<Style Selector="^ /template/ Panel#PART_PopupButtonPanel">
<Setter Property="DockPanel.Dock" Value="Bottom"></Setter>
<Setter Property="DockPanel.Dock" Value="Bottom" />
</Style>
<Style Selector="^ /template/ ToggleButton#button">
<Setter Property="Padding" Value="0 8"></Setter>
<Setter Property="Padding" Value="0 8" />
</Style>
<Style Selector="^ /template/ PathIcon#PART_Icon">
<Setter Property="Data" Value="{DynamicResource ToolBarVerticalMoreGlyph}"></Setter>
<Setter Property="Width" Value="16"></Setter>
<Setter Property="Height" Value="{x:Static x:Double.NaN}"></Setter>
<Setter Property="Data" Value="{DynamicResource ToolBarVerticalMoreGlyph}" />
<Setter Property="Width" Value="16" />
<Setter Property="Height" Value="{x:Static x:Double.NaN}" />
</Style>
</Style>
<Style Selector="^:overflow /template/ ToggleButton#button">
<Setter Property="IsVisible" Value="True"></Setter>
<Setter Property="IsVisible" Value="True" />
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type u:ToolBarSeparator}" TargetType="u:ToolBarSeparator">
<Setter Property="Template">
<ControlTemplate>
<Rectangle Name="PART_Rect" Margin="4 " Fill="{DynamicResource SemiColorBorder}"></Rectangle>
<Rectangle
Name="PART_Rect"
Margin="4"
Fill="{DynamicResource SemiColorBorder}" />
</ControlTemplate>
</Setter>
<Style Selector="^ /template/ Rectangle#PART_Rect">
<Setter Property="Width" Value="1"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="Width" Value="1" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style Selector="^:vertical /template/ Rectangle#PART_Rect">
<Setter Property="Height" Value="1"></Setter>
<Setter Property="Height" Value="1" />
<Setter Property="Width" Value="{x:Static x:Double.NaN}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</ControlTheme>
</ResourceDictionary>