Files
aistudio-wpf-diagram/AIStudio.Wpf.DiagramDesigner/Styles/Expander.xaml

117 lines
5.2 KiB
Plaintext
Raw Normal View History

2022-12-02 23:06:31 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
2022-12-05 22:48:00 +08:00
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Shared.xaml" />
</ResourceDictionary.MergedDictionaries>
2022-12-02 23:06:31 +08:00
2022-12-05 22:48:00 +08:00
<!-- SimpleStyles: Expander -->
2022-12-02 23:06:31 +08:00
2022-12-05 22:48:00 +08:00
<ControlTemplate x:Key="ExpanderToggleButton" TargetType="ToggleButton">
<Border
2022-12-02 23:06:31 +08:00
Name="Border"
CornerRadius="2,0,0,0"
Background="Transparent"
BorderBrush="{StaticResource NormalBorderBrush}"
BorderThickness="0,0,0,0">
2022-12-05 22:48:00 +08:00
<Path
2022-12-02 23:06:31 +08:00
Name="Arrow"
Fill="{StaticResource GlyphBrush}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 L 4 4 L 8 0 Z"/>
2022-12-05 22:48:00 +08:00
</Border>
<ControlTemplate.Triggers>
<Trigger Property="ToggleButton.IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background"
2022-12-02 23:06:31 +08:00
Value="{StaticResource DarkBrush}" />
2022-12-05 22:48:00 +08:00
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="Border" Property="Background"
2022-12-02 23:06:31 +08:00
Value="{StaticResource PressedBrush}" />
2022-12-05 22:48:00 +08:00
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="Arrow" Property="Data"
2022-12-02 23:06:31 +08:00
Value="M 0 4 L 4 0 L 8 4 Z" />
2022-12-05 22:48:00 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background"
2022-12-02 23:06:31 +08:00
Value="{StaticResource DisabledBackgroundBrush}" />
2022-12-05 22:48:00 +08:00
<Setter TargetName="Border" Property="BorderBrush"
2022-12-02 23:06:31 +08:00
Value="{StaticResource DisabledBorderBrush}" />
2022-12-05 22:48:00 +08:00
<Setter Property="Foreground"
2022-12-02 23:06:31 +08:00
Value="{StaticResource DisabledForegroundBrush}"/>
2022-12-05 22:48:00 +08:00
<Setter TargetName="Arrow" Property="Fill"
2022-12-02 23:06:31 +08:00
Value="{StaticResource DisabledForegroundBrush}" />
2022-12-05 22:48:00 +08:00
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
2022-12-02 23:06:31 +08:00
2022-12-05 22:48:00 +08:00
<Style TargetType="Expander">
<Setter Property="FontFamily" Value="SegoeUI"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="#4C4C4C"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Expander">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Name="ContentRow" Height="0"/>
</Grid.RowDefinitions>
<Border
2022-12-02 23:06:31 +08:00
Name="Border"
Grid.Row="0"
Background="{StaticResource LightBrush}"
BorderBrush="{StaticResource NormalBorderBrush}"
BorderThickness="1"
CornerRadius="2,2,0,0" >
2022-12-05 22:48:00 +08:00
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ToggleButton
2022-12-02 23:06:31 +08:00
IsChecked="{Binding Path=IsExpanded,Mode=TwoWay,
RelativeSource={RelativeSource TemplatedParent}}"
OverridesDefaultStyle="True"
Template="{StaticResource ExpanderToggleButton}"
Background="{StaticResource NormalBrush}" />
2022-12-05 22:48:00 +08:00
<ContentPresenter
2022-12-02 23:06:31 +08:00
Grid.Column="1"
Margin="4"
ContentSource="Header"
RecognizesAccessKey="True" />
2022-12-05 22:48:00 +08:00
</Grid>
</Border>
<Border
2022-12-02 23:06:31 +08:00
Name="Content"
Grid.Row="1"
Background="{StaticResource WindowBackgroundBrush}"
BorderBrush="{StaticResource SolidBorderBrush}"
BorderThickness="1,0,1,1"
CornerRadius="0,0,2,2" >
2022-12-05 22:48:00 +08:00
<ContentPresenter Margin="4" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter TargetName="ContentRow" Property="Height"
2022-12-02 23:06:31 +08:00
Value="{Binding ElementName=Content,Path=DesiredHeight}" />
2022-12-05 22:48:00 +08:00
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Border" Property="Background"
2022-12-02 23:06:31 +08:00
Value="{StaticResource DisabledBackgroundBrush}" />
2022-12-05 22:48:00 +08:00
<Setter TargetName="Border" Property="BorderBrush"
2022-12-02 23:06:31 +08:00
Value="{StaticResource DisabledBorderBrush}" />
2022-12-05 22:48:00 +08:00
<Setter Property="Foreground"
2022-12-02 23:06:31 +08:00
Value="{StaticResource DisabledForegroundBrush}"/>
2022-12-05 22:48:00 +08:00
</Trigger>
2022-12-02 23:06:31 +08:00
2022-12-05 22:48:00 +08:00
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
2022-12-02 23:06:31 +08:00
</ResourceDictionary>