Files
ShrlAlgoToolkit/AntDesignWPF/Controls/AntWindow/WindowButtons.xaml
2025-07-31 20:12:24 +08:00

83 lines
5.1 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:AntDesignWPF.Controls"
xmlns:helpers="clr-namespace:AntDesignWPF.Helpers"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Themes/Converters.xaml" />
<ResourceDictionary Source="pack://application:,,,/AntDesignWPF;component/Controls/AntWindow/WindowButton.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style
BasedOn="{StaticResource Ant.WindowButton}"
TargetType="{x:Type Button}"
x:Key="Ant.WindowCloseButton">
<Setter Property="helpers:AntControl.MouseOverBackground" Value="{DynamicResource AntDesign.Brush.Error}" />
<Setter Property="helpers:AntControl.PressedBackground" Value="{Binding Path=(helpers:AntControl.MouseOverBackground), Mode=OneWay, ConverterParameter=7, RelativeSource={RelativeSource Self}, Converter={StaticResource ColorPaletteConverter}}" />
</Style>
<Style TargetType="{x:Type controls:WindowButtons}">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="MinimizeStyle" Value="{StaticResource Ant.WindowButton}" />
<Setter Property="MaximizeStyle" Value="{StaticResource Ant.WindowButton}" />
<Setter Property="CloseStyle" Value="{StaticResource Ant.WindowCloseButton}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:WindowButtons}">
<StackPanel Orientation="Horizontal">
<Button
ToolTip="{TemplateBinding Minimize}"
Visibility="{Binding ResizeMode, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:AntWindow}}, Converter={StaticResource ResizeModeToVisibilityConverter}, ConverterParameter=MIN}"
x:Name="PART_Min">
<Path
Data="M0,1 L 12,1 12,1.8 0,1.8z"
Fill="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
RenderOptions.EdgeMode="Aliased" />
</Button>
<Button
ToolTip="{TemplateBinding Maximize}"
Visibility="{Binding ResizeMode, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type controls:AntWindow}}, Converter={StaticResource ResizeModeToVisibilityConverter}, ConverterParameter=MAX}"
x:Name="PART_Max">
<Path
Data="M0,0 L12,0 12,11 0,11z M1,1 L11,1 11,10.5 1,10.5z"
Fill="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
RenderOptions.EdgeMode="Aliased"
UseLayoutRounding="True"
x:Name="PART_MaxPath" />
</Button>
<Button
ToolTip="{TemplateBinding Close}"
UseLayoutRounding="True"
x:Name="PART_Close">
<Grid>
<Line
Stroke="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
X1="0"
X2="11"
Y1="0"
Y2="11" />
<Line
Stroke="{Binding Foreground, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
X1="0"
X2="11"
Y1="11"
Y2="0" />
</Grid>
</Button>
</StackPanel>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource AncestorType={x:Type controls:AntWindow}}}" Value="Maximized">
<Setter Property="ToolTip" TargetName="PART_Max" Value="{Binding Restore, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="Data" TargetName="PART_MaxPath" Value="M2,2 L2,0 12,0 12,10 10.5,10 10.5,9 11,9 11,1 2.5,1 2.5,2z M0,2 L10.5,2 10.5,11 0,11z M1,2.5 L10,2.5 10,10.5 1,10.5z" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>