458 lines
28 KiB
XML
458 lines
28 KiB
XML
<ResourceDictionary
|
||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
xmlns:assists="clr-namespace:Melskin.Assists"
|
||
xmlns:controls="clr-namespace:Melskin.Controls"
|
||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||
<ControlTemplate TargetType="{x:Type Button}" x:Key="WindowNormalButtonTemplate">
|
||
<Border
|
||
Background="{TemplateBinding Background}"
|
||
SnapsToDevicePixels="True"
|
||
x:Name="border">
|
||
<ContentPresenter
|
||
Focusable="False"
|
||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
Margin="{TemplateBinding Padding}"
|
||
RecognizesAccessKey="True"
|
||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
x:Name="contentPresenter" />
|
||
</Border>
|
||
<ControlTemplate.Triggers>
|
||
<MultiTrigger>
|
||
<MultiTrigger.Conditions>
|
||
<Condition Property="IsMouseOver" Value="True" />
|
||
<Condition Property="Background" Value="Transparent" />
|
||
</MultiTrigger.Conditions>
|
||
<Setter Property="Background" TargetName="border" Value="{DynamicResource BackgroundLayoutBrush}" />
|
||
<!--<Setter TargetName="border" Property="Effect">
|
||
<Setter.Value>
|
||
<effects:BrightnessContrastEffect Brightness="0.1" />
|
||
</Setter.Value>
|
||
</Setter>-->
|
||
<Setter Property="Background" TargetName="border" Value="#1A000000" />
|
||
<Setter Property="Opacity" Value="1" />
|
||
</MultiTrigger>
|
||
<Trigger Property="IsPressed" Value="True">
|
||
<!--<Setter TargetName="border" Property="Effect">
|
||
<Setter.Value>
|
||
<effects:BrightnessContrastEffect Brightness="0.05" />
|
||
</Setter.Value>
|
||
</Setter>-->
|
||
<Setter Property="Background" TargetName="border" Value="#33000000" />
|
||
</Trigger>
|
||
<Trigger Property="IsEnabled" Value="False">
|
||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{Binding Path=(assists:ShadingAssist.DisabledForeground), RelativeSource={RelativeSource TemplatedParent}}" />
|
||
</Trigger>
|
||
</ControlTemplate.Triggers>
|
||
</ControlTemplate>
|
||
<ControlTemplate TargetType="{x:Type Button}" x:Key="WindowCloseButtonTemplate">
|
||
<Border
|
||
Background="{TemplateBinding Background}"
|
||
SnapsToDevicePixels="True"
|
||
x:Name="border">
|
||
<ContentPresenter
|
||
Focusable="False"
|
||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
Margin="{TemplateBinding Padding}"
|
||
RecognizesAccessKey="True"
|
||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||
x:Name="contentPresenter" />
|
||
</Border>
|
||
<ControlTemplate.Triggers>
|
||
<Trigger Property="IsMouseOver" Value="True">
|
||
<Setter Property="Background" TargetName="border" Value="#E81123" />
|
||
<Setter Property="Foreground" Value="#e0e0e0" />
|
||
</Trigger>
|
||
<Trigger Property="IsPressed" Value="True">
|
||
<Setter Property="Background" TargetName="border" Value="#F1707A" />
|
||
<Setter Property="Foreground" Value="#edbebb" />
|
||
</Trigger>
|
||
<Trigger Property="IsEnabled" Value="False">
|
||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundDisabledBrush}" />
|
||
<Setter Property="Foreground" Value="{Binding Path=(assists:ShadingAssist.DisabledForeground), RelativeSource={RelativeSource TemplatedParent}}" />
|
||
</Trigger>
|
||
</ControlTemplate.Triggers>
|
||
</ControlTemplate>
|
||
<!-- 窗口标题按钮 -->
|
||
<Style TargetType="{x:Type Button}" x:Key="WindowButton">
|
||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||
<Setter Property="Focusable" Value="False" />
|
||
<Setter Property="UseLayoutRounding" Value="True" />
|
||
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource TextDisabledBrush}" />
|
||
<Setter Property="Background" Value="Transparent" />
|
||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||
<Setter Property="FontSize" Value="14" />
|
||
<!--<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />-->
|
||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
<Setter Property="VerticalAlignment" Value="Center" />
|
||
<Setter Property="Width" Value="46" />
|
||
<Setter Property="Height" Value="32" />
|
||
<Setter Property="Template" Value="{StaticResource WindowNormalButtonTemplate}" />
|
||
<Style.Triggers>
|
||
<Trigger Property="Tag" Value="Close">
|
||
<Setter Property="Template" Value="{StaticResource WindowCloseButtonTemplate}" />
|
||
</Trigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
<Style TargetType="{x:Type Button}" x:Key="WindowCloseButton">
|
||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||
<Setter Property="Focusable" Value="False" />
|
||
<Setter Property="UseLayoutRounding" Value="True" />
|
||
<Setter Property="assists:ShadingAssist.DisabledForeground" Value="{DynamicResource TextDisabledBrush}" />
|
||
<Setter Property="Background" Value="Transparent" />
|
||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
|
||
<Setter Property="FontSize" Value="14" />
|
||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||
<Setter Property="VerticalAlignment" Value="Center" />
|
||
<Setter Property="Width" Value="46" />
|
||
<Setter Property="Height" Value="32" />
|
||
<Setter Property="Template" Value="{StaticResource WindowNormalButtonTemplate}" />
|
||
</Style>
|
||
|
||
<Style TargetType="{x:Type ResizeGrip}" x:Key="ResizeGripStyle">
|
||
<Setter Property="Background" Value="Transparent" />
|
||
<Setter Property="Height" Value="18" />
|
||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||
<Setter Property="Opacity" Value="0.75" />
|
||
<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="Fill" Value="{Binding BorderBackgroundBrush, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" />-->
|
||
<Setter Property="Fill" Value="{DynamicResource TextSecondaryBrush}" />
|
||
<Setter Property="Height" Value="2" />
|
||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||
<Setter Property="VerticalAlignment" Value="Top" />
|
||
<Setter Property="Width" Value="2" />
|
||
</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>
|
||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
||
<Setter Property="Visibility" Value="Collapsed" />
|
||
<Setter Property="Width" Value="18" />
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource TemplatedParent}}" Value="CanResizeWithGrip">
|
||
<Setter Property="Visibility" Value="Visible" />
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
|
||
<Style TargetType="controls:MelWindow" x:Key="NeoWindowStyle">
|
||
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
||
<Setter Property="MinWidth" Value="300" />
|
||
<Setter Property="WindowChrome.WindowChrome">
|
||
<Setter.Value>
|
||
<WindowChrome UseAeroCaptionButtons="False">
|
||
<!--<WindowChrome.ResizeBorderThickness>6</WindowChrome.ResizeBorderThickness>
|
||
<WindowChrome.NonClientFrameEdges>Left,Bottom,Right</WindowChrome.NonClientFrameEdges>-->
|
||
</WindowChrome>
|
||
</Setter.Value>
|
||
</Setter>
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="controls:MelWindow">
|
||
<ControlTemplate.Resources>
|
||
<!-- 激活窗口后,窗口内容逐渐清晰,不透明度增加到1 -->
|
||
<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 x:Name="windowBorder">
|
||
<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>
|
||
<Grid Background="{TemplateBinding Background}" x:Name="RootGrid">
|
||
<Grid.RowDefinitions>
|
||
<RowDefinition Height="32" />
|
||
<RowDefinition Height="*" />
|
||
</Grid.RowDefinitions>
|
||
<Grid.ColumnDefinitions>
|
||
<ColumnDefinition Width="Auto" />
|
||
<ColumnDefinition Width="*" />
|
||
<ColumnDefinition Width="Auto" />
|
||
</Grid.ColumnDefinitions>
|
||
<!-- 自定义标题栏 -->
|
||
<!-- 上方背景 -->
|
||
<Border
|
||
Background="{TemplateBinding assists:ColorAssist.TitleBarBackground}"
|
||
Grid.Column="0"
|
||
Grid.ColumnSpan="3"
|
||
Grid.Row="0" />
|
||
<StackPanel
|
||
Grid.Column="0"
|
||
Grid.Row="0"
|
||
Orientation="Horizontal">
|
||
<!-- 图标容器 -->
|
||
<Image
|
||
Margin="10,10,4,4"
|
||
Panel.ZIndex="2048"
|
||
RenderOptions.BitmapScalingMode="HighQuality"
|
||
Source="{TemplateBinding Icon}"
|
||
Stretch="Uniform"
|
||
VerticalAlignment="Center" />
|
||
|
||
<!-- 左侧标题栏容器 -->
|
||
<ContentControl
|
||
Content="{TemplateBinding TitleBarLeftContent}"
|
||
Margin="0,6,8,0"
|
||
VerticalAlignment="Center"
|
||
VerticalContentAlignment="Center"
|
||
WindowChrome.IsHitTestVisibleInChrome="True"
|
||
x:Name="LeftContent" />
|
||
|
||
</StackPanel>
|
||
<!-- 标题 -->
|
||
<Label
|
||
Grid.Column="1"
|
||
Grid.Row="0"
|
||
HorizontalAlignment="Left"
|
||
Margin="0,6,0,0"
|
||
Padding="12,2">
|
||
<TextBlock
|
||
FontSize="14"
|
||
Foreground="{DynamicResource TextPrimaryBrush}"
|
||
Text="{TemplateBinding Title}"
|
||
x:Name="TitleBlock">
|
||
<TextBlock.Style>
|
||
<Style TargetType="TextBlock">
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding Path=WindowStyle, RelativeSource={RelativeSource TemplatedParent}}" Value="None">
|
||
<Setter Property="Visibility" Value="Collapsed" />
|
||
</DataTrigger>
|
||
<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>
|
||
</TextBlock.Style>
|
||
</TextBlock>
|
||
</Label>
|
||
<StackPanel
|
||
Grid.Column="2"
|
||
Grid.Row="0"
|
||
HorizontalAlignment="Right"
|
||
Orientation="Horizontal"
|
||
WindowChrome.IsHitTestVisibleInChrome="True">
|
||
<!-- 右侧内容容器 -->
|
||
<ContentControl
|
||
Content="{TemplateBinding TitleBarRightContent}"
|
||
VerticalAlignment="Center"
|
||
VerticalContentAlignment="Center"
|
||
WindowChrome.IsHitTestVisibleInChrome="True"
|
||
x:Name="RightContent" />
|
||
<!-- 功能按钮 -->
|
||
<Button ToolTip="最小化" x:Name="minimizeButton">
|
||
<Button.Style>
|
||
<Style BasedOn="{StaticResource WindowButton}" TargetType="Button">
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
|
||
<Setter Property="IsEnabled" Value="False" />
|
||
<Setter Property="Visibility" Value="Collapsed" />
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</Button.Style>
|
||
<controls:IconElement
|
||
FontSize="24"
|
||
Foreground="{Binding ElementName=minimizeButton, Path=Foreground}"
|
||
Padding="0,-14,0,0"
|
||
SnapsToDevicePixels="True"
|
||
Symbol="Minimize"
|
||
UseLayoutRounding="True" />
|
||
</Button>
|
||
<Button WindowChrome.IsHitTestVisibleInChrome="True" x:Name="maximizeRestoreButton">
|
||
<Button.Style>
|
||
<Style BasedOn="{StaticResource WindowButton}" TargetType="Button">
|
||
<Style.Triggers>
|
||
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Normal">
|
||
<!-- 最大化 -->
|
||
<Setter Property="Content">
|
||
<Setter.Value>
|
||
<controls:IconElement FontSize="20" Symbol="Fullscreen" />
|
||
</Setter.Value>
|
||
</Setter>
|
||
<!-- 提示 -->
|
||
<Setter Property="ToolTip" Value="最大化" />
|
||
</DataTrigger>
|
||
<DataTrigger Binding="{Binding Path=WindowState, RelativeSource={RelativeSource TemplatedParent}}" Value="Maximized">
|
||
<Setter Property="Content">
|
||
<Setter.Value>
|
||
<!-- 恢复 -->
|
||
<controls:IconElement FontSize="20" Symbol="FullscreenExit" />
|
||
</Setter.Value>
|
||
</Setter>
|
||
<Setter Property="ToolTip" Value="恢复" />
|
||
</DataTrigger>
|
||
<!-- 切换显示 -->
|
||
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
|
||
<Setter Property="IsEnabled" Value="False" />
|
||
<Setter Property="Visibility" Value="Collapsed" />
|
||
</DataTrigger>
|
||
<DataTrigger Binding="{Binding Path=ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="CanMinimize">
|
||
<Setter Property="IsEnabled" Value="False" />
|
||
<Setter Property="Visibility" Value="Collapsed" />
|
||
</DataTrigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</Button.Style>
|
||
</Button>
|
||
|
||
<Button
|
||
ToolTip="关闭"
|
||
WindowChrome.IsHitTestVisibleInChrome="True"
|
||
x:Name="closeButton">
|
||
<Button.Style>
|
||
<Style BasedOn="{StaticResource WindowButton}" TargetType="Button">
|
||
<Setter Property="Tag" Value="Close" />
|
||
<!--<Style.Triggers>
|
||
<Trigger Property="IsMouseOver" Value="True">
|
||
<Setter Property="Background" Value="{DynamicResource ErrorBrush}" />
|
||
<Setter Property="Foreground" Value="#e0e0e0" />
|
||
</Trigger>
|
||
<Trigger Property="IsPressed" Value="True">
|
||
<Setter Property="Background" Value="{DynamicResource ErrorPressedBrush}" />
|
||
<Setter Property="Foreground" Value="#edbebb" />
|
||
</Trigger>
|
||
</Style.Triggers>-->
|
||
</Style>
|
||
</Button.Style>
|
||
<controls:IconElement
|
||
FontSize="22"
|
||
Foreground="{Binding ElementName=closeButton, Path=Foreground}"
|
||
SnapsToDevicePixels="True"
|
||
Symbol="Close"
|
||
UseLayoutRounding="True" />
|
||
</Button>
|
||
</StackPanel>
|
||
<!-- 窗体内容 -->
|
||
<Border
|
||
Background="{TemplateBinding Background}"
|
||
Grid.Column="0"
|
||
Grid.ColumnSpan="3"
|
||
Grid.Row="1"
|
||
HorizontalAlignment="Stretch"
|
||
Panel.ZIndex="1000"
|
||
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>
|
||
<ResizeGrip
|
||
Grid.Column="2"
|
||
Grid.Row="1"
|
||
Panel.ZIndex="2048"
|
||
Style="{StaticResource ResizeGripStyle}"
|
||
x:Name="resizeGrip" />
|
||
</Grid>
|
||
</Border>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
<Style.Triggers>
|
||
<Trigger Property="WindowState" Value="Normal">
|
||
<Setter Property="WindowChrome.WindowChrome">
|
||
<Setter.Value>
|
||
<WindowChrome ResizeBorderThickness="4" />
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Trigger>
|
||
<Trigger Property="WindowState" Value="Maximized">
|
||
<Setter Property="WindowChrome.WindowChrome">
|
||
<Setter.Value>
|
||
<WindowChrome ResizeBorderThickness="0" />
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Trigger>
|
||
<Trigger Property="ResizeMode" Value="CanResizeWithGrip">
|
||
<Setter Property="WindowChrome.WindowChrome">
|
||
<Setter.Value>
|
||
<WindowChrome ResizeBorderThickness="4,4,18,18" />
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Trigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
<Style BasedOn="{StaticResource NeoWindowStyle}" TargetType="controls:MelWindow" />
|
||
</ResourceDictionary> |