520 lines
32 KiB
Plaintext
520 lines
32 KiB
Plaintext
|
|
<ResourceDictionary
|
||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:controls="clr-namespace:Szmedi.AIScriptRunner.Controls"
|
||
|
|
xmlns:converters="clr-namespace:Szmedi.AIScriptRunner.Converters"
|
||
|
|
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||
|
|
<!--<ResourceDictionary.MergedDictionaries>
|
||
|
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
|
||
|
|
</ResourceDictionary.MergedDictionaries>-->
|
||
|
|
<converters:NotNullToVisibilityConverter NullValue="Collapsed" x:Key="NotNullToVisibilityConverter" />
|
||
|
|
<converters:WindowTitleBarIconVisibilityConverter x:Key="WindowTitleBarIconVisibilityConverter" />
|
||
|
|
<converters:WindowTitleVisibilityConverter x:Key="WindowTitleVisibilityConverter" />
|
||
|
|
<converters:WindowCaptionButtonVisibilityConverter x:Key="WindowCaptionButtonVisibilityConverter" />
|
||
|
|
<converters:WindowCaptionButtonEnabledConverter x:Key="WindowCaptionButtonEnabledConverter" />
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type Button}" x:Key="WindowButtonStyle">
|
||
|
|
<Setter Property="Padding" Value="8,0,8,0" />
|
||
|
|
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||
|
|
<Setter Property="Cursor" Value="Hand" />
|
||
|
|
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
|
||
|
|
<Setter Property="Foreground" Value="{Binding Path=BorderForegroundBrush, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||
|
|
<Setter Property="Background" Value="Transparent" />
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type Button}">
|
||
|
|
<Grid>
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding Foreground}"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<Border.Style>
|
||
|
|
<Style TargetType="Border">
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType=Button}}" Value="False">
|
||
|
|
<Setter Property="Opacity" Value="0" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=IsMouseOver, RelativeSource={RelativeSource AncestorType=Button}}" Value="True">
|
||
|
|
<Setter Property="Opacity" Value="0.25" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
</Border.Style>
|
||
|
|
</Border>
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
Padding="{TemplateBinding Padding}"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<AdornerDecorator>
|
||
|
|
<ContentPresenter
|
||
|
|
Content="{TemplateBinding Content}"
|
||
|
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||
|
|
HorizontalAlignment="Center"
|
||
|
|
VerticalAlignment="Center" />
|
||
|
|
</AdornerDecorator>
|
||
|
|
</Border>
|
||
|
|
</Grid>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
<Style.Triggers>
|
||
|
|
<Trigger Property="IsMouseOver" Value="False">
|
||
|
|
<Setter Property="Opacity" Value="0.75" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
|
<Setter Property="Opacity" Value="1" />
|
||
|
|
</Trigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style
|
||
|
|
BasedOn="{StaticResource WindowButtonStyle}"
|
||
|
|
TargetType="{x:Type Button}"
|
||
|
|
x:Key="WindowMinimizeButtonStyle">
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
|
||
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
||
|
|
<Setter Property="IsEnabled" Value="False" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="CanMinimize">
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
<Setter Property="IsEnabled" Value="True" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="CanResize">
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
<Setter Property="IsEnabled" Value="True" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="CanResizeWithGrip">
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
<Setter Property="IsEnabled" Value="True" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style
|
||
|
|
BasedOn="{StaticResource WindowButtonStyle}"
|
||
|
|
TargetType="{x:Type Button}"
|
||
|
|
x:Key="WindowMaximizeRestoreButtonStyle">
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
|
||
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
||
|
|
<Setter Property="IsEnabled" Value="False" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="CanMinimize">
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
<Setter Property="IsEnabled" Value="False" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="CanResize">
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
<Setter Property="IsEnabled" Value="True" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="CanResizeWithGrip">
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
<Setter Property="IsEnabled" Value="True" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Normal">
|
||
|
|
<Setter Property="ToolTip" Value="最大化" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Maximized">
|
||
|
|
<Setter Property="ToolTip" Value="恢复" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style
|
||
|
|
BasedOn="{StaticResource WindowButtonStyle}"
|
||
|
|
TargetType="{x:Type Button}"
|
||
|
|
x:Key="WindowCloseButtonStyle">
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
<Setter Property="IsEnabled" Value="True" />
|
||
|
|
<Style.Triggers>
|
||
|
|
<Trigger Property="IsMouseOver" Value="True">
|
||
|
|
<Setter Property="Background" Value="Red"/>
|
||
|
|
<Setter Property="Foreground" Value="White"/>
|
||
|
|
</Trigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type md:PackIcon}" x:Key="WindowButtonIconStyle">
|
||
|
|
<Setter Property="Width" Value="24" />
|
||
|
|
<Setter Property="Height" Value="24" />
|
||
|
|
<Setter Property="Foreground" Value="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}" />
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type TextBlock}" x:Key="WindowTitleTextBlockStyle">
|
||
|
|
<Setter Property="FontSize" Value="14" />
|
||
|
|
<Setter Property="Foreground" Value="{Binding Path=BorderForegroundBrush, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||
|
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type ResizeGrip}" x:Key="ResizeGripStyle">
|
||
|
|
<Setter Property="Height" Value="18" />
|
||
|
|
<Setter Property="Width" Value="18" />
|
||
|
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||
|
|
<Setter Property="VerticalAlignment" Value="Bottom" />
|
||
|
|
<Setter Property="Background" Value="Transparent" />
|
||
|
|
<Setter Property="Opacity" Value="0.75" />
|
||
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type ResizeGrip}">
|
||
|
|
<Grid
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
Height="18"
|
||
|
|
SnapsToDevicePixels="True"
|
||
|
|
Width="18">
|
||
|
|
<Grid.Resources>
|
||
|
|
<Style TargetType="Rectangle">
|
||
|
|
<Setter Property="Height" Value="2" />
|
||
|
|
<Setter Property="Width" Value="2" />
|
||
|
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||
|
|
<Setter Property="VerticalAlignment" Value="Top" />
|
||
|
|
<Setter Property="Fill" Value="{Binding BorderBackgroundBrush, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />
|
||
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||
|
|
</Style>
|
||
|
|
</Grid.Resources>
|
||
|
|
<Rectangle Margin="14,2,0,0" />
|
||
|
|
<Rectangle Margin="14,6,0,0" />
|
||
|
|
<Rectangle Margin="14,10,0,0" />
|
||
|
|
<Rectangle Margin="14,14,0,0" />
|
||
|
|
<Rectangle Margin="10,6,0,0" />
|
||
|
|
<Rectangle Margin="10,10,0,0" />
|
||
|
|
<Rectangle Margin="10,14,0,0" />
|
||
|
|
<Rectangle Margin="6,10,0,0" />
|
||
|
|
<Rectangle Margin="6,14,0,0" />
|
||
|
|
<Rectangle Margin="2,14,0,0" />
|
||
|
|
</Grid>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource TemplatedParent}}" Value="CanResizeWithGrip">
|
||
|
|
<Setter Property="Visibility" Value="Visible" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type controls:MaterialWindow}" x:Key="MaterialWindowStyle">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Background}" />
|
||
|
|
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Foreground}" />
|
||
|
|
<!--<Setter Property="TitleBarIcon" Value="{Binding icon}" />-->
|
||
|
|
<Setter Property="BorderBackgroundBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark}" />
|
||
|
|
<Setter Property="BorderForegroundBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Dark.Foreground}" />
|
||
|
|
<Setter Property="FontFamily" Value="Microsoft YaHei UI" />
|
||
|
|
<Setter Property="FadeContentIfInactive" Value="True" />
|
||
|
|
<Setter Property="TitleTemplate">
|
||
|
|
<Setter.Value>
|
||
|
|
<DataTemplate>
|
||
|
|
<TextBlock
|
||
|
|
Margin="8,0,0,0"
|
||
|
|
Style="{StaticResource WindowTitleTextBlockStyle}"
|
||
|
|
Text="{Binding Path=Title, RelativeSource={RelativeSource AncestorType={x:Type controls:MaterialWindow}}}" />
|
||
|
|
</DataTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type controls:MaterialWindow}">
|
||
|
|
<ControlTemplate.Resources>
|
||
|
|
<Storyboard x:Key="OpacityInStoryboard">
|
||
|
|
<DoubleAnimation
|
||
|
|
Duration="0:0:0.2"
|
||
|
|
From="0.75"
|
||
|
|
Storyboard.TargetProperty="Opacity"
|
||
|
|
To="1">
|
||
|
|
<DoubleAnimation.EasingFunction>
|
||
|
|
<SineEase EasingMode="EaseOut" />
|
||
|
|
</DoubleAnimation.EasingFunction>
|
||
|
|
</DoubleAnimation>
|
||
|
|
</Storyboard>
|
||
|
|
<Storyboard x:Key="OpacityOutStoryboard">
|
||
|
|
<DoubleAnimation
|
||
|
|
Duration="0:0:0.2"
|
||
|
|
From="1"
|
||
|
|
Storyboard.TargetProperty="Opacity"
|
||
|
|
To="0.75">
|
||
|
|
<DoubleAnimation.EasingFunction>
|
||
|
|
<SineEase EasingMode="EaseOut" />
|
||
|
|
</DoubleAnimation.EasingFunction>
|
||
|
|
</DoubleAnimation>
|
||
|
|
</Storyboard>
|
||
|
|
</ControlTemplate.Resources>
|
||
|
|
<Border>
|
||
|
|
<Border.Style>
|
||
|
|
<Style TargetType="{x:Type Border}">
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Normal">
|
||
|
|
<Setter Property="Padding" Value="0" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Maximized">
|
||
|
|
<Setter Property="Padding" Value="8" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
</Border.Style>
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding BorderBackgroundBrush}"
|
||
|
|
BorderBrush="{TemplateBinding BorderBackgroundBrush}"
|
||
|
|
ClipToBounds="True"
|
||
|
|
Grid.Column="1"
|
||
|
|
Grid.Row="1"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<Border.Style>
|
||
|
|
<Style TargetType="{x:Type Border}">
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Normal">
|
||
|
|
<Setter Property="BorderThickness" Value="1" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Maximized">
|
||
|
|
<Setter Property="BorderThickness" Value="0" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
</Border.Style>
|
||
|
|
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||
|
|
<Grid.ColumnDefinitions>
|
||
|
|
<ColumnDefinition Width="Auto" />
|
||
|
|
<ColumnDefinition Width="100*" />
|
||
|
|
<ColumnDefinition Width="Auto" />
|
||
|
|
</Grid.ColumnDefinitions>
|
||
|
|
<Grid.RowDefinitions>
|
||
|
|
<RowDefinition Height="Auto" />
|
||
|
|
<RowDefinition Height="100*" />
|
||
|
|
</Grid.RowDefinitions>
|
||
|
|
|
||
|
|
<!-- window icon -->
|
||
|
|
<Image
|
||
|
|
Height="24"
|
||
|
|
Margin="8,0,8,0"
|
||
|
|
Panel.ZIndex="2048"
|
||
|
|
Source="{TemplateBinding Icon}"
|
||
|
|
VerticalAlignment="Center"
|
||
|
|
Width="24">
|
||
|
|
<Image.Visibility>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowTitleBarIconVisibilityConverter}">
|
||
|
|
<Binding Path="Icon" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Image.Visibility>
|
||
|
|
</Image>
|
||
|
|
|
||
|
|
<!-- window title -->
|
||
|
|
<Border
|
||
|
|
Grid.Column="1"
|
||
|
|
Grid.Row="0"
|
||
|
|
Height="32"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
Panel.ZIndex="2048"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<Border.Visibility>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowTitleVisibilityConverter}">
|
||
|
|
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Border.Visibility>
|
||
|
|
<Border.Style>
|
||
|
|
<Style TargetType="Border">
|
||
|
|
<Style.Triggers>
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding Path=FadeContentIfInactive, RelativeSource={RelativeSource TemplatedParent}}" Value="True" />
|
||
|
|
<Condition Binding="{Binding Path=IsActive, RelativeSource={RelativeSource TemplatedParent}}" Value="True" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
<MultiDataTrigger.EnterActions>
|
||
|
|
<BeginStoryboard Storyboard="{StaticResource OpacityInStoryboard}" />
|
||
|
|
</MultiDataTrigger.EnterActions>
|
||
|
|
<MultiDataTrigger.ExitActions>
|
||
|
|
<BeginStoryboard Storyboard="{StaticResource OpacityOutStoryboard}" />
|
||
|
|
</MultiDataTrigger.ExitActions>
|
||
|
|
</MultiDataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
</Border.Style>
|
||
|
|
<ContentControl
|
||
|
|
ContentTemplate="{TemplateBinding TitleTemplate}"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
VerticalAlignment="Stretch" />
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- caption buttons -->
|
||
|
|
<StackPanel
|
||
|
|
Grid.Column="2"
|
||
|
|
Grid.Row="0"
|
||
|
|
Height="32"
|
||
|
|
Orientation="Horizontal"
|
||
|
|
Panel.ZIndex="2048"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<StackPanel.Visibility>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowTitleVisibilityConverter}">
|
||
|
|
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</StackPanel.Visibility>
|
||
|
|
<Button
|
||
|
|
Style="{StaticResource WindowMinimizeButtonStyle}"
|
||
|
|
ToolTip="最小化"
|
||
|
|
x:Name="minimizeButton">
|
||
|
|
<Button.Visibility>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||
|
|
<Binding
|
||
|
|
Mode="OneTime"
|
||
|
|
Path="MinimizeButtonName"
|
||
|
|
Source="{StaticResource WindowCaptionButtonVisibilityConverter}" />
|
||
|
|
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
<Binding Path="ResizeMode" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Button.Visibility>
|
||
|
|
<Button.IsEnabled>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowCaptionButtonEnabledConverter}">
|
||
|
|
<Binding
|
||
|
|
Mode="OneTime"
|
||
|
|
Path="MinimizeButtonName"
|
||
|
|
Source="{StaticResource WindowCaptionButtonEnabledConverter}" />
|
||
|
|
<Binding Path="ResizeMode" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Button.IsEnabled>
|
||
|
|
<md:PackIcon Kind="WindowMinimize" Style="{StaticResource WindowButtonIconStyle}" />
|
||
|
|
</Button>
|
||
|
|
<Button Style="{StaticResource WindowMaximizeRestoreButtonStyle}" x:Name="maximizeRestoreButton">
|
||
|
|
<Button.Visibility>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||
|
|
<Binding
|
||
|
|
Mode="OneTime"
|
||
|
|
Path="MaximizeRestoreButtonName"
|
||
|
|
Source="{StaticResource WindowCaptionButtonVisibilityConverter}" />
|
||
|
|
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
<Binding Path="ResizeMode" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Button.Visibility>
|
||
|
|
<Button.IsEnabled>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowCaptionButtonEnabledConverter}">
|
||
|
|
<Binding
|
||
|
|
Mode="OneTime"
|
||
|
|
Path="MaximizeRestoreButtonName"
|
||
|
|
Source="{StaticResource WindowCaptionButtonEnabledConverter}" />
|
||
|
|
<Binding Path="ResizeMode" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Button.IsEnabled>
|
||
|
|
<md:PackIcon>
|
||
|
|
<md:PackIcon.Style>
|
||
|
|
<Style BasedOn="{StaticResource WindowButtonIconStyle}" TargetType="{x:Type md:PackIcon}">
|
||
|
|
<Style.Triggers>
|
||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Normal">
|
||
|
|
<Setter Property="Kind" Value="WindowMaximize" />
|
||
|
|
</DataTrigger>
|
||
|
|
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Maximized">
|
||
|
|
<Setter Property="Kind" Value="WindowRestore" />
|
||
|
|
</DataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
</md:PackIcon.Style>
|
||
|
|
</md:PackIcon>
|
||
|
|
</Button>
|
||
|
|
<Button
|
||
|
|
Style="{StaticResource WindowCloseButtonStyle}"
|
||
|
|
ToolTip="关闭"
|
||
|
|
x:Name="closeButton">
|
||
|
|
<Button.Visibility>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowCaptionButtonVisibilityConverter}">
|
||
|
|
<Binding
|
||
|
|
Mode="OneTime"
|
||
|
|
Path="CloseButtonName"
|
||
|
|
Source="{StaticResource WindowCaptionButtonVisibilityConverter}" />
|
||
|
|
<Binding Path="WindowStyle" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
<Binding Path="ResizeMode" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Button.Visibility>
|
||
|
|
<Button.IsEnabled>
|
||
|
|
<MultiBinding Converter="{StaticResource WindowCaptionButtonEnabledConverter}">
|
||
|
|
<Binding
|
||
|
|
Mode="OneTime"
|
||
|
|
Path="CloseButtonName"
|
||
|
|
Source="{StaticResource WindowCaptionButtonEnabledConverter}" />
|
||
|
|
<Binding Path="ResizeMode" RelativeSource="{RelativeSource TemplatedParent}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</Button.IsEnabled>
|
||
|
|
<md:PackIcon Kind="WindowClose" Style="{StaticResource WindowButtonIconStyle}" />
|
||
|
|
</Button>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- window content -->
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
Grid.Column="0"
|
||
|
|
Grid.ColumnSpan="3"
|
||
|
|
Grid.Row="1"
|
||
|
|
HorizontalAlignment="Stretch"
|
||
|
|
Panel.ZIndex="2047"
|
||
|
|
VerticalAlignment="Stretch">
|
||
|
|
<AdornerDecorator>
|
||
|
|
<ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}">
|
||
|
|
<ContentPresenter.Style>
|
||
|
|
<Style TargetType="ContentPresenter">
|
||
|
|
<Style.Triggers>
|
||
|
|
<MultiDataTrigger>
|
||
|
|
<MultiDataTrigger.Conditions>
|
||
|
|
<Condition Binding="{Binding Path=FadeContentIfInactive, RelativeSource={RelativeSource TemplatedParent}}" Value="True" />
|
||
|
|
<Condition Binding="{Binding Path=IsActive, RelativeSource={RelativeSource TemplatedParent}}" Value="True" />
|
||
|
|
</MultiDataTrigger.Conditions>
|
||
|
|
<MultiDataTrigger.EnterActions>
|
||
|
|
<BeginStoryboard Storyboard="{StaticResource OpacityInStoryboard}" />
|
||
|
|
</MultiDataTrigger.EnterActions>
|
||
|
|
<MultiDataTrigger.ExitActions>
|
||
|
|
<BeginStoryboard Storyboard="{StaticResource OpacityOutStoryboard}" />
|
||
|
|
</MultiDataTrigger.ExitActions>
|
||
|
|
</MultiDataTrigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
</ContentPresenter.Style>
|
||
|
|
</ContentPresenter>
|
||
|
|
</AdornerDecorator>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- resize grip -->
|
||
|
|
<ResizeGrip
|
||
|
|
Grid.Column="2"
|
||
|
|
Grid.Row="1"
|
||
|
|
Panel.ZIndex="2048"
|
||
|
|
Style="{StaticResource ResizeGripStyle}"
|
||
|
|
x:Name="resizeGrip" />
|
||
|
|
</Grid>
|
||
|
|
</Border>
|
||
|
|
</Border>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
<Style.Triggers>
|
||
|
|
<Trigger Property="WindowState" Value="Normal">
|
||
|
|
<Setter Property="WindowChrome.WindowChrome">
|
||
|
|
<Setter.Value>
|
||
|
|
<WindowChrome
|
||
|
|
CaptionHeight="28"
|
||
|
|
ResizeBorderThickness="4"
|
||
|
|
UseAeroCaptionButtons="False" />
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="WindowState" Value="Maximized">
|
||
|
|
<Setter Property="WindowChrome.WindowChrome">
|
||
|
|
<Setter.Value>
|
||
|
|
<WindowChrome
|
||
|
|
CaptionHeight="40"
|
||
|
|
ResizeBorderThickness="0"
|
||
|
|
UseAeroCaptionButtons="False" />
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="ResizeMode" Value="CanResizeWithGrip">
|
||
|
|
<Setter Property="WindowChrome.WindowChrome">
|
||
|
|
<Setter.Value>
|
||
|
|
<WindowChrome
|
||
|
|
CaptionHeight="28"
|
||
|
|
ResizeBorderThickness="4,4,18,18"
|
||
|
|
UseAeroCaptionButtons="False" />
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Trigger>
|
||
|
|
</Style.Triggers>
|
||
|
|
</Style>
|
||
|
|
|
||
|
|
</ResourceDictionary>
|