enhance: optimized ElementGroup

This commit is contained in:
NaBian committed 2022-01-19 22:56:50 +08:00
1 parent 483370f218
commit fda076b5e6
14 files changed
+330 -215

No files matched your search

@@ -587,6 +587,27 @@
<TextBlock Visibility="{Binding ShowText,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Boolean2VisibilityConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Text}" />
</hc:SimplePanel>
</ControlTemplate>
<ItemsPanelTemplate x:Key="UniformHorizontalItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="UniformVerticalItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Columns="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackHorizontalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackVerticalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapHorizontalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapVerticalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="DockItemsPanelTemplate">
<DockPanel FocusVisualStyle="{x:Null}" LastChildFill="True" />
</ItemsPanelTemplate>
<LinearGradientBrush x:Key="ResizeGripperForeground" EndPoint="1,0.75" StartPoint="0,0.25">
<GradientStop Color="#FFFFFF" Offset="0.3" />
<GradientStop Color="#BBC5D7" Offset="0.75" />
@@ -722,12 +743,6 @@
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
<ItemsPanelTemplate x:Key="StepBarHorizontalItemsPanelTemplate">
<UniformGrid Rows="1" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StepBarVerticalItemsPanelTemplate">
<UniformGrid Columns="1" />
</ItemsPanelTemplate>
<ContextMenu x:Key="TabItemMenu" x:Shared="False">
<MenuItem Command="interactivity:ControlCommands.Close" Header="{x:Static langs:Lang.Close}" />
<MenuItem Command="interactivity:ControlCommands.CloseAll" Header="{x:Static langs:Lang.CloseAll}" />
@@ -813,21 +828,6 @@
</Setter.Value>
</Setter>
</Style>
<ItemsPanelTemplate x:Key="WrapPanelHorizontalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="WrapPanelVerticalItemsPanelTemplate">
<WrapPanel FocusVisualStyle="{x:Null}" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackPanelHorizontalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" Orientation="Horizontal" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="StackPanelVerticalItemsPanelTemplate">
<StackPanel FocusVisualStyle="{x:Null}" HorizontalAlignment="Stretch" />
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="ComboBoxCapsuleItemsPanelTemplate">
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1" />
</ItemsPanelTemplate>
<tools:ComboBoxItemCapsuleStyleSelector x:Key="ComboBoxItemCapsuleStyleSelector" />
<hc:HorizontalAlignmentPathTemplateSelector x:Key="HorizontalAlignmentPathTemplateSelector" />
<hc:VerticalAlignmentPathTemplateSelector x:Key="VerticalAlignmentPathTemplateSelector" />
@@ -2479,6 +2479,39 @@
</MultiTrigger>
</Style.Triggers>
</Style>
<Style x:Key="ElementGroupBaseStyle" TargetType="hc:ElementGroup">
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Layout" Value="Uniform" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Setter Property="hc:VisualElement.HighlightBorderBrush" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="hc:VisualElement.HighlightBackground" Value="{DynamicResource RegionBrush}" />
<Setter Property="hc:VisualElement.HighlightForeground" Value="{DynamicResource PrimaryBrush}" />
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Uniform" />
<Condition Property="Orientation" Value="Vertical" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Stack" />
<Condition Property="Orientation" Value="Horizontal" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}" />
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Layout" Value="Stack" />
<Condition Property="Orientation" Value="Vertical" />
</MultiTrigger.Conditions>
<Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}" />
</MultiTrigger>
</Style.Triggers>
</Style>
<Style x:Key="ProgressBarBaseStyle" TargetType="ProgressBar">
<Setter Property="hc:VisualElement.Text">
<Setter.Value>
@@ -10626,23 +10659,23 @@
<Setter Property="Focusable" Value="False" />
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalTop}" />
<Setter Property="Template" Value="{StaticResource StepBarHorizontalTopControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Style.Triggers>
<Trigger Property="Dock" Value="Left">
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" />
<Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarVerticalItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</Trigger>
<Trigger Property="Dock" Value="Bottom">
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemHorizontalBottom}" />
<Setter Property="Template" Value="{StaticResource StepBarHorizontalBottomControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarHorizontalItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
</Trigger>
<Trigger Property="Dock" Value="Right">
<Setter Property="FlowDirection" Value="RightToLeft" />
<Setter Property="ItemContainerStyle" Value="{StaticResource StepBarItemVerticalLeft}" />
<Setter Property="Template" Value="{StaticResource StepBarVerticalLeftControlTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StepBarVerticalItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource UniformVerticalItemsPanelTemplate}" />
</Trigger>
</Style.Triggers>
</Style>
@@ -12137,7 +12170,6 @@
</ControlTemplate.Triggers>
<hc:SimplePanel ClipToBounds="True">
<StackPanel x:Name="PART_Panel" Orientation="Horizontal" />
<!--<ItemsPresenter x:Name="PART_ItemsControl" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Left"/>-->
<hc:SimplePanel x:Name="GridTop" Opacity="0">
<Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}">
<Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4">
@@ -12472,6 +12504,12 @@
<Style BasedOn="{StaticResource DialogBaseStyle}" TargetType="hc:Dialog" />
<Style BasedOn="{StaticResource DividerBaseStyle}" TargetType="hc:Divider" />
<Style BasedOn="{StaticResource DrawerBaseStyle}" TargetType="hc:Drawer" />
<Style BasedOn="{StaticResource ElementGroupBaseStyle}" TargetType="hc:ElementGroup" />
<Style x:Key="ElementGroupSolid" BasedOn="{StaticResource ElementGroupBaseStyle}" TargetType="hc:ElementGroup">
<Setter Property="hc:VisualElement.HighlightBorderBrush" Value="{DynamicResource TitleBrush}" />
<Setter Property="hc:VisualElement.HighlightBackground" Value="{DynamicResource TitleBrush}" />
<Setter Property="hc:VisualElement.HighlightForeground" Value="{DynamicResource TextIconBrush}" />
</Style>
<Style BasedOn="{StaticResource EmptyBaseStyle}" TargetType="hc:Empty" />
<Style BasedOn="{StaticResource ExpanderBaseStyle}" TargetType="Expander" />
<Style BasedOn="{StaticResource FlowDocumentScrollViewerBaseStyle}" TargetType="FlowDocumentScrollViewer" />
@@ -12616,16 +12654,16 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
<Style x:Key="WrapPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelHorizontalItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource WrapHorizontalItemsPanelTemplate}" />
</Style>
<Style x:Key="WrapPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource WrapPanelVerticalItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource WrapVerticalItemsPanelTemplate}" />
</Style>
<Style x:Key="StackPanelHorizontalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelHorizontalItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StackHorizontalItemsPanelTemplate}" />
</Style>
<Style x:Key="StackPanelVerticalListBox" BasedOn="{StaticResource ListBoxCustom}" TargetType="ListBox">
<Setter Property="ItemsPanel" Value="{StaticResource StackPanelVerticalItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource StackVerticalItemsPanelTemplate}" />
</Style>
<Style x:Key="ListViewBaseStyle" TargetType="ListView">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
@@ -13052,7 +13090,7 @@
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Focusable" Value="False" />
<Setter Property="ItemsPanel" Value="{StaticResource ComboBoxCapsuleItemsPanelTemplate}" />
<Setter Property="ItemsPanel" Value="{StaticResource UniformHorizontalItemsPanelTemplate}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">