更新
This commit is contained in:
82
AntdWpf/Styles/WindowCommands.xaml
Normal file
82
AntdWpf/Styles/WindowCommands.xaml
Normal file
@@ -0,0 +1,82 @@
|
||||
<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:Window}}}"
|
||||
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:Window}},
|
||||
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>
|
||||
Reference in New Issue
Block a user