You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
5.6 KiB
Plaintext

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<!--最小化按钮样式-->
<Style x:Key="WinMinBtnStyle" TargetType="Button">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Width" Value="25"/>
<Setter Property="Height" Value="25"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="MainBorder" Background="Transparent">
<Grid>
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="MainBorder" Property="Background" Value="#0b7bc5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--关闭按钮样式-->
<Style x:Key="WinCloseBtnStyle" TargetType="Button">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Width" Value="25"/>
<Setter Property="Height" Value="25"/>
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="MainBorder" Background="Transparent">
<Grid>
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="MainBorder" Property="Background" Value="#0b7bc5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--窗体控件模板-->
<ControlTemplate x:Key="MetroWindowTemplate" TargetType="{x:Type Window}">
<Border BorderBrush="#0b7bc5" BorderThickness="1" Background="White">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="#0b7bc5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="WindowTitleTbl" Grid.Column="0" Text="{TemplateBinding Title}" FontFamily="Microsoft YaHei" VerticalAlignment="Center"
FontSize="12" FontWeight="Bold" Margin="10,0" Foreground="White"/>
<Button x:Name="MinWinButton" Grid.Column="2" Style="{StaticResource WinMinBtnStyle}"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center">
<Button.Content>
<StackPanel>
<Path Stroke="White" StrokeThickness="2" Data="M1,6 L18,6"/>
</StackPanel>
</Button.Content>
</Button>
<Button x:Name="CloseWinButton" Grid.Column="3" Style="{StaticResource WinCloseBtnStyle}" Margin="2,0,8,0"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center">
<Button.Content>
<StackPanel>
<Path Stroke="White" StrokeThickness="2" Data="M2,2 L16,16 M2,16 L16,2"/>
</StackPanel>
</Button.Content>
</Button>
</Grid>
<AdornerDecorator Grid.Row="1">
<ContentPresenter/>
</AdornerDecorator>
</Grid>
<Border.Effect>
<DropShadowEffect/>
</Border.Effect>
</Border>
</ControlTemplate>
<Style x:Key="MetroWindowStyle" TargetType="{x:Type Window}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="AllowsTransparency" Value="True"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="Template" Value="{StaticResource MetroWindowTemplate}"/>
</Style>
</ResourceDictionary>