更新
This commit is contained in:
344
WPFDark/Controls/BiaWindow.xaml
Normal file
344
WPFDark/Controls/BiaWindow.xaml
Normal file
@@ -0,0 +1,344 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:WPFDark.Controls"
|
||||
xmlns:internals="clr-namespace:WPFDark.Controls.Internals"
|
||||
xmlns:wpf="clr-namespace:WPFDark">
|
||||
<Style TargetType="{x:Type controls:BiaWindow}">
|
||||
<Setter Property="FontFamily" Value="{DynamicResource WPFDarkFontFamily}" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:BiaWindow}">
|
||||
<AdornerDecorator>
|
||||
<Border x:Name="Border"
|
||||
Background="{DynamicResource BackgroundBackgroundBrushKey}"
|
||||
BorderThickness="1">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrushKey}" />
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBorderBrushKey}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="24" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- Title Background -->
|
||||
<Rectangle Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
Grid.ColumnSpan="5"
|
||||
Margin="0"
|
||||
Fill="#303038"
|
||||
StrokeThickness="0" />
|
||||
<!-- Icon -->
|
||||
<Rectangle Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="0"
|
||||
Width="36"
|
||||
Height="36"
|
||||
Margin="6,0"
|
||||
Fill="{Binding IconBrush, RelativeSource={RelativeSource AncestorType={x:Type controls:BiaWindow}}}" />
|
||||
<!-- Title -->
|
||||
<TextBlock Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="6,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="18"
|
||||
Text="{TemplateBinding Title}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource AccentForegroundBrushKey}" />
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource InactiveForegroundBrushKey}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
|
||||
<!-- Menu -->
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="3"
|
||||
Margin="47,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Content="{Binding Menu, RelativeSource={RelativeSource AncestorType={x:Type controls:BiaWindow}}}"
|
||||
WindowChrome.IsHitTestVisibleInChrome="True" />
|
||||
|
||||
<ContentPresenter x:Name="ContentPresenter"
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="5"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch" />
|
||||
|
||||
<!-- Shadow -->
|
||||
<Rectangle Grid.Row="0"
|
||||
Grid.RowSpan="3"
|
||||
Grid.ColumnSpan="5"
|
||||
Height="5"
|
||||
Margin="0,48,0,0"
|
||||
VerticalAlignment="Top"
|
||||
IsHitTestVisible="False">
|
||||
<Rectangle.Fill>
|
||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
|
||||
<GradientStop Offset="0.0" Color="#FF181818" />
|
||||
<GradientStop Offset="1.0" Color="#00181818" />
|
||||
</LinearGradientBrush>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
|
||||
<!-- System Button -->
|
||||
<StackPanel Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="5"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<internals:BiaHamburgerMenuHost MenuItem="{Binding HamburgerMenu,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type controls:BiaWindow}},
|
||||
Mode=OneWay}" />
|
||||
<internals:BiaSystemButton IsVisibleButton="{TemplateBinding IsVisibleMinimizeButton}" WindowAction="{x:Static wpf:BiaWindowAction.Minimize}" />
|
||||
<internals:BiaSystemButton IsVisibleButton="{TemplateBinding IsVisibleMaximizeButton}" WindowAction="{x:Static wpf:BiaWindowAction.Maximize}" />
|
||||
<internals:BiaSystemButton IsVisibleButton="{TemplateBinding IsVisibleNormalizeButton}" WindowAction="{x:Static wpf:BiaWindowAction.Normalize}" />
|
||||
<internals:BiaSystemButton IsVisibleButton="{TemplateBinding IsVisibleCloseButtonButton}" WindowAction="{x:Static wpf:BiaWindowAction.Close}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</AdornerDecorator>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="WindowState" Value="Maximized">
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="8" />
|
||||
</Trigger>
|
||||
<Trigger Property="WindowState" Value="Normal">
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="1" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetName="ContentPresenter">
|
||||
<DoubleAnimation Duration="0:0:0.15"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.EnterActions>
|
||||
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetName="ContentPresenter">
|
||||
<DoubleAnimation Duration="0:0:0.1"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1.0" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
|
||||
<Setter Property="TextOptions.TextHintingMode" Value="Animated" />
|
||||
|
||||
<Setter Property="TextOptions.TextRenderingMode" Value="Auto" />
|
||||
<Setter Property="ToolTipService.BetweenShowDelay" Value="0" />
|
||||
|
||||
<Setter Property="ToolTipService.InitialShowDelay" Value="0" />
|
||||
<Setter Property="ToolTipService.ShowDuration" Value="100000" />
|
||||
<Setter Property="UseLayoutRounding" Value="True" />
|
||||
|
||||
<Setter Property="WindowChrome.WindowChrome">
|
||||
<Setter.Value>
|
||||
<WindowChrome CaptionHeight="32.0"
|
||||
CornerRadius="0"
|
||||
GlassFrameThickness="1"
|
||||
ResizeBorderThickness="8" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="WPFDarkStyle" TargetType="{x:Type controls:BiaWindow}">
|
||||
<Setter Property="FontFamily" Value="{DynamicResource WPFDarkFontFamily}" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:BiaWindow}">
|
||||
<AdornerDecorator>
|
||||
<Border x:Name="Border"
|
||||
Background="{DynamicResource BackgroundBackgroundBrushKey}"
|
||||
BorderThickness="1">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrushKey}" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BackgroundBorderBrushKey}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- Title Background -->
|
||||
<Rectangle Grid.ColumnSpan="5"
|
||||
Margin="0"
|
||||
Fill="#303038"
|
||||
StrokeThickness="0" />
|
||||
|
||||
<!-- Icon -->
|
||||
<!-- <Rectangle Width="24"
|
||||
Height="24"
|
||||
Margin="6,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Fill="{Binding IconBrush, RelativeSource={RelativeSource AncestorType={x:Type controls:BiaWindow}}}" /> -->
|
||||
<ContentPresenter x:Name="PART_Icon"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="0"
|
||||
Width="24"
|
||||
Height="24"
|
||||
Content="{TemplateBinding Icon}"
|
||||
Focusable="False"
|
||||
RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
<!-- Title -->
|
||||
<TextBlock Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="6,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="18"
|
||||
Text="{TemplateBinding Title}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource AccentForegroundBrushKey}" />
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource InactiveForegroundBrushKey}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
|
||||
<ContentPresenter x:Name="ContentPresenter"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="4"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch" />
|
||||
|
||||
<!-- Shadow -->
|
||||
<Rectangle Grid.Row="0"
|
||||
Grid.ColumnSpan="4"
|
||||
Height="5"
|
||||
Margin="0,32,0,0"
|
||||
IsHitTestVisible="False">
|
||||
<Rectangle.Fill>
|
||||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
|
||||
<GradientStop Offset="0.0" Color="#FF181818" />
|
||||
<GradientStop Offset="1.0" Color="#00181818" />
|
||||
</LinearGradientBrush>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
|
||||
<!-- System Button -->
|
||||
<StackPanel Grid.Row="0"
|
||||
Grid.Column="4"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<internals:BiaHamburgerMenuHost MenuItem="{Binding HamburgerMenu,
|
||||
RelativeSource={RelativeSource AncestorType={x:Type controls:BiaWindow}},
|
||||
Mode=OneWay}" />
|
||||
<internals:BiaSystemButton IsVisibleButton="{TemplateBinding IsVisibleMinimizeButton}" WindowAction="{x:Static wpf:BiaWindowAction.Minimize}" />
|
||||
<internals:BiaSystemButton IsVisibleButton="{TemplateBinding IsVisibleMaximizeButton}" WindowAction="{x:Static wpf:BiaWindowAction.Maximize}" />
|
||||
<internals:BiaSystemButton IsVisibleButton="{TemplateBinding IsVisibleNormalizeButton}" WindowAction="{x:Static wpf:BiaWindowAction.Normalize}" />
|
||||
<internals:BiaSystemButton IsVisibleButton="{TemplateBinding IsVisibleCloseButtonButton}" WindowAction="{x:Static wpf:BiaWindowAction.Close}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</AdornerDecorator>
|
||||
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="WindowState" Value="Maximized">
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="8" />
|
||||
</Trigger>
|
||||
<Trigger Property="WindowState" Value="Normal">
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="1" />
|
||||
</Trigger>
|
||||
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetName="ContentPresenter">
|
||||
<DoubleAnimation Duration="0:0:0.15"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.EnterActions>
|
||||
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard TargetName="ContentPresenter">
|
||||
<DoubleAnimation Duration="0:0:0.1"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1.0" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
|
||||
<Setter Property="TextOptions.TextHintingMode" Value="Animated" />
|
||||
|
||||
<Setter Property="TextOptions.TextRenderingMode" Value="Auto" />
|
||||
<Setter Property="ToolTipService.BetweenShowDelay" Value="0" />
|
||||
|
||||
<Setter Property="ToolTipService.InitialShowDelay" Value="0" />
|
||||
<Setter Property="ToolTipService.ShowDuration" Value="100000" />
|
||||
<Setter Property="UseLayoutRounding" Value="True" />
|
||||
|
||||
<Setter Property="WindowChrome.WindowChrome">
|
||||
<Setter.Value>
|
||||
<WindowChrome CaptionHeight="32.0"
|
||||
CornerRadius="0"
|
||||
GlassFrameThickness="1"
|
||||
ResizeBorderThickness="8" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user