Files
ShrlAlgoToolkit/AntDesignWPF/Styles/WindowCommands.xaml
2025-07-31 20:12:01 +08:00

76 lines
4.5 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:AntDesign.WPF.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/AntDesign.WPF;component/Styles/Converters.xaml" />
<ResourceDictionary Source="pack://application:,,,/AntDesign.WPF;component/Styles/WindowButton.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type controls:WindowCommands}">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:WindowCommands}">
<ControlTemplate.Resources>
<!-- Separator -->
<Style TargetType="Separator">
<Setter Property="Padding" Value="4,0" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Rectangle
Fill="{Binding TitleBarForeground, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:AntdWindow}}}"
Height="{Binding SeparatorHeight, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:WindowCommands}}}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
UseLayoutRounding="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Width="1"
x:Name="Separator" />
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding SeparatorHeight, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:WindowCommands}}}" Value="NaN">
<Setter Property="Height" TargetName="Separator" Value="{Binding TitleBarHeight, Mode=OneWay, ConverterParameter=2, RelativeSource={RelativeSource AncestorType={x:Type controls:AntdWindow}}, Converter={StaticResource DivisionConverter}}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Buttons -->
<Style BasedOn="{StaticResource Ant.WindowButton}" TargetType="Button" />
<Style BasedOn="{StaticResource Ant.WindowButton}" TargetType="ToggleButton" />
</ControlTemplate.Resources>
<ItemsPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type controls:WindowCommandsItem}">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:WindowCommandsItem}">
<ContentPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>