feat: Expander.

This commit is contained in:
Zhang Dian 2024-09-29 13:32:13 +08:00
parent 3e5fa9d5bf
commit 56c30dcb8b
3 changed files with 15 additions and 17 deletions

View File

@ -9,7 +9,7 @@
</StackPanel>
</Design.PreviewWith>
<ControlTheme x:Key="ExpanderHeaderToggleButtonTheme" TargetType="ToggleButton">
<Setter Property="ToggleButton.Template">
<Setter Property="Template">
<ControlTemplate TargetType="ToggleButton">
<ContentPresenter
Padding="{TemplateBinding Padding}"
@ -19,13 +19,13 @@
</Setter>
</ControlTheme>
<ControlTheme x:Key="{x:Type Expander}" TargetType="Expander">
<Setter Property="Expander.BorderThickness" Value="1" />
<Setter Property="Expander.BorderBrush" Value="{DynamicResource ExpanderSeparatorBorderBrush}" />
<Setter Property="Expander.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="Expander.HorizontalAlignment" Value="Stretch" />
<Setter Property="Expander.HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Expander.VerticalContentAlignment" Value="Stretch" />
<Setter Property="Expander.Template">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="{DynamicResource ExpanderSeparatorBorderBrush}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<ControlTemplate TargetType="Expander">
<DockPanel>
<LayoutTransformControl x:Name="ExpanderHeaderLayoutContainer" Margin="{DynamicResource ExpanderHeaderMargin}">
@ -37,8 +37,7 @@
Background="{DynamicResource ExpanderHeaderDefaultBackground}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
IsChecked="{TemplateBinding IsExpanded,
Mode=TwoWay}"
IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}"
IsEnabled="{TemplateBinding IsEnabled}"
TextElement.FontWeight="{DynamicResource ExpanderHeaderFontWeight}"
TextElement.Foreground="{DynamicResource ExpanderHeaderForeground}"
@ -77,8 +76,7 @@
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Foreground="{DynamicResource ExpanderContentForeground}"
IsVisible="{TemplateBinding IsExpanded,
Mode=TwoWay}" />
IsVisible="{TemplateBinding IsExpanded, Mode=TwoWay}" />
</Border>
</LayoutTransformControl>
</DockPanel>

View File

@ -6,8 +6,8 @@
<Setter Property="Focusable" Value="True" />
<Setter Property="MinWidth" Value="6" />
<Setter Property="MinHeight" Value="6" />
<Setter Property="GridSplitter.ClipToBounds" Value="False" />
<Setter Property="GridSplitter.Padding" Value="2" />
<Setter Property="ClipToBounds" Value="False" />
<Setter Property="Padding" Value="2" />
<Setter Property="Background" Value="{DynamicResource GridSplitterBackground}" />
<Setter Property="PreviewContent">
<Template>

View File

@ -219,11 +219,11 @@
<SolidColorBrush x:Key="DateTimePickerButtonDisabledIconForeground" Color="{StaticResource GrayTextColor}" />
<!-- Expander -->
<SolidColorBrush x:Key="ExpanderSeparatorBorderBrush" Color="{StaticResource WindowTextColor}" />
<SolidColorBrush x:Key="ExpanderHeaderForeground" Color="{StaticResource WindowTextColor}" />
<SolidColorBrush x:Key="ExpanderSeparatorBorderBrush" Color="{StaticResource ButtonTextColor}" />
<SolidColorBrush x:Key="ExpanderHeaderForeground" Color="{StaticResource ButtonTextColor}" />
<SolidColorBrush x:Key="ExpanderHeaderDisabledForeground" Color="{StaticResource GrayTextColor}" />
<SolidColorBrush x:Key="ExpanderHeaderDefaultBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ExpanderHeaderHoverBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ExpanderHeaderHoverBackground" Color="{StaticResource HighlightTextColor}" />
<SolidColorBrush x:Key="ExpanderHeaderPressedBackground" Color="{StaticResource WindowColor}" />
<SolidColorBrush x:Key="ExpanderContentForeground" Color="{StaticResource WindowTextColor}" />