命名调整
This commit is contained in:
188
AntdWpf/Styles/AntWindow.xaml
Normal file
188
AntdWpf/Styles/AntWindow.xaml
Normal file
@@ -0,0 +1,188 @@
|
||||
<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"
|
||||
xmlns:Shell="clr-namespace:Microsoft.Windows.Shell"
|
||||
xmlns:AntdShell="clr-namespace:AntdWpf.Microsoft.Windows.Shell"
|
||||
xmlns:helpers="clr-namespace:AntdWpf.Helpers">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Styles/Converters.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="Ant.TitleBarThumb" TargetType="{x:Type Thumb}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Grid Background="{TemplateBinding Background}" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type controls:AntdWindow}">
|
||||
<Setter Property="WindowStyle" Value="None" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" />
|
||||
<Setter Property="Icon" Value="{StaticResource AntDesignDrawingImage}"/>
|
||||
<!--<Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />-->
|
||||
<Setter Property="FontSize" Value="{DynamicResource FontSizeBase}" />
|
||||
<!--<Setter Property="Template" Value="{StaticResource Ant.WindowTemplate}" />-->
|
||||
<Setter Property="Background" Value="{DynamicResource BodyBackground}" />
|
||||
<Setter Property="TitleBarForeground" Value="{DynamicResource WindowTilteBarForeground}" />
|
||||
<Setter Property="TitleBarBackground" Value="{DynamicResource WindowTilteBarBackground}" />
|
||||
<Setter Property="IconTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Image Stretch="None"
|
||||
VerticalAlignment="Center"
|
||||
Source="{TemplateBinding Content}" />
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="TitleTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<TextBlock Margin="8 0"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Text="{TemplateBinding Content}"
|
||||
FontSize="{DynamicResource FontSizeSmall}" />
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="AntdShell:WindowChrome.WindowChrome">
|
||||
<Setter.Value>
|
||||
<AntdShell:WindowChrome CornerRadius="0"
|
||||
CaptionHeight="0"
|
||||
UseAeroCaptionButtons="False"
|
||||
GlassFrameThickness="0 0 0 0.1" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:AntdWindow}">
|
||||
<Border UseLayoutRounding="True"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
LayoutTransform="{TemplateBinding LayoutTransform}"
|
||||
RenderTransform="{TemplateBinding RenderTransform}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
CornerRadius="{TemplateBinding helpers:AntdControl.CornerRadius}"
|
||||
Margin="{Binding WindowNonClientFrameThickness, Source={x:Static Shell:SystemParameters2.Current}}">
|
||||
<AdornerDecorator>
|
||||
<Grid x:Name="LayoutRoot"
|
||||
UseLayoutRounding="False">
|
||||
<Grid.ColumnDefinitions>
|
||||
<!-- icon -->
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<!-- left window commands -->
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<!-- title -->
|
||||
<ColumnDefinition Width="*" />
|
||||
<!-- right window commands -->
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<!-- min,max,close buttons -->
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- title bar -->
|
||||
<Rectangle x:Name="PART_TitleBar"
|
||||
Grid.ColumnSpan="5"
|
||||
Focusable="False"
|
||||
StrokeThickness="0"
|
||||
Height="{TemplateBinding TitleBarHeight}"
|
||||
Fill="{TemplateBinding TitleBarBackground}" />
|
||||
<!-- Note:
|
||||
thumb 元素必须放在标题栏背景之后,
|
||||
否则会影响双击标题栏窗口以最大化
|
||||
-->
|
||||
<controls:Thumb x:Name="PART_TitleBarThumb"
|
||||
Grid.ColumnSpan="5"
|
||||
Style="{StaticResource Ant.TitleBarThumb}" />
|
||||
<!-- icon -->
|
||||
<ContentPresenter x:Name="PART_Icon"
|
||||
Focusable="False"
|
||||
VerticalAlignment="Top"
|
||||
Content="{TemplateBinding Icon}"
|
||||
Height="{TemplateBinding TitleBarHeight}"
|
||||
ContentTemplate="{TemplateBinding IconTemplate}" />
|
||||
<!-- 左侧窗口命令 -->
|
||||
<ContentPresenter x:Name="PART_LeftWindowCommands"
|
||||
Grid.Column="1"
|
||||
Focusable="False"
|
||||
VerticalAlignment="Top"
|
||||
Height="{TemplateBinding TitleBarHeight}"
|
||||
Content="{TemplateBinding LeftWindowCommands}" />
|
||||
<!-- title -->
|
||||
<controls:ThumbContentControl x:Name="PART_Title"
|
||||
Grid.Column="2"
|
||||
Focusable="False"
|
||||
Content="{TemplateBinding Title}"
|
||||
Height="{TemplateBinding TitleBarHeight}"
|
||||
Foreground="{TemplateBinding TitleBarForeground}"
|
||||
ContentTemplate="{TemplateBinding TitleTemplate}"
|
||||
HorizontalAlignment="{TemplateBinding TitleAlignment}"
|
||||
ContentCharacterCasing="{TemplateBinding TitleCharacterCasing}" />
|
||||
<!-- 右侧窗口命令 -->
|
||||
<ContentPresenter x:Name="PART_RightWindowCommands"
|
||||
Grid.Column="3"
|
||||
Focusable="False"
|
||||
VerticalAlignment="Top"
|
||||
Height="{TemplateBinding TitleBarHeight}"
|
||||
Content="{TemplateBinding RightWindowCommands}" />
|
||||
<!-- Window 按钮命令 -->
|
||||
<ContentPresenter x:Name="PART_WindowButtons"
|
||||
Grid.Column="4"
|
||||
Focusable="False"
|
||||
VerticalAlignment="Top"
|
||||
Content="{TemplateBinding WindowButtons}"
|
||||
Height="{TemplateBinding TitleBarHeight}" />
|
||||
<!-- 主窗口内容 -->
|
||||
<ContentPresenter Grid.Row="1"
|
||||
Grid.ColumnSpan="5"
|
||||
Focusable="False" />
|
||||
<!-- ResizeGrip -->
|
||||
<ResizeGrip x:Name="WindowResizeGrip"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="5"
|
||||
IsTabStop="False"
|
||||
Visibility="Collapsed"
|
||||
UseLayoutRounding="True"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom" />
|
||||
</Grid>
|
||||
</AdornerDecorator>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="UseNoneWindowStyle" Value="True">
|
||||
<Setter TargetName="PART_TitleBarThumb" Property="Grid.RowSpan" Value="2" />
|
||||
</Trigger>
|
||||
<Trigger Property="Icon" Value="{x:Null}">
|
||||
<Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IgnoreTaskbar" Value="False" />
|
||||
<Condition Property="WindowState" Value="Maximized" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="LayoutRoot" Property="Margin" Value="7" />
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="ResizeMode" Value="CanResizeWithGrip" />
|
||||
<Condition Property="WindowState" Value="Normal" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible" />
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
Reference in New Issue
Block a user