Files
Shrlalgo.RvKits/AntdWpf/Styles/WindowCommands.xaml
2025-07-12 23:31:32 +08:00

82 lines
5.0 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:AntdWpf.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Converters.xaml" />
<ResourceDictionary Source="pack://application:,,,/AntdWpf;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 x:Name="Separator"
Width="1"
UseLayoutRounding="True"
IsHitTestVisible="False"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Fill="{Binding TitleBarForeground, Mode=OneWay,
RelativeSource={RelativeSource AncestorType={x:Type controls:AntdWindow}}}"
Height="{Binding SeparatorHeight, Mode=OneWay,
RelativeSource={RelativeSource AncestorType={x:Type controls:WindowCommands}}}" />
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding SeparatorHeight, Mode=OneWay,
RelativeSource={RelativeSource AncestorType={x:Type controls:WindowCommands}}}"
Value="NaN">
<Setter TargetName="Separator"
Property="Height"
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>