-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRDMyWindow.xaml
executable file
·97 lines (97 loc) · 6.22 KB
/
RDMyWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:local="clr-namespace:NCMMS"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="bannerBtn" TargetType="{x:Type Button}">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Width" Value="25" />
<Setter Property="Height" Value="16" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Style.Triggers>
<Trigger Property="Button.IsPressed" Value="True">
<Setter Property="Width" Value="23"/>
<Setter Property="Control.Height" Value="14"/>
</Trigger>
<Trigger Property="Button.IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 能否把trigger定义为资源,这样下面三个按钮就不用重复三次定义触发器了
<Trigger x:Key="btnTrigger" Property="Button.IsMouseOver" Value="True">
<Setter TargetName="border" Property="Border.Background" Value="#7FFF" />
</Trigger>-->
<ControlTemplate x:Key="btnMinCT">
<Border x:Name="border" BorderThickness="0.5,0,0.5,0.5" CornerRadius="0,0,0,3" BorderBrush="#395684" >
<Image Source="/NCMMS;component/Images/minimize.png" Stretch="Uniform" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#7FFF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="btnMaxCT">
<Grid>
<Border x:Name="border" BorderThickness="0,0,0.5,0.5" CornerRadius="0" BorderBrush="#395684" />
<Image x:Name="imageMaximize" Source="/NCMMS;component/Images/maximize.png" Stretch="Uniform" />
<Image x:Name="imageRestore" Visibility="Hidden" Source="/NCMMS;component/Images/restore.png" Stretch="Uniform" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#7FFF" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="btnCloseCT">
<Border x:Name="border" BorderThickness="0,0,0.5,0.5" CornerRadius="0,0,3,0" BorderBrush="#395684" >
<Image Source="/NCMMS;component/Images/close.png" Stretch="Uniform" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#7F00" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!--<SolidColorBrush x:Key="defaultWindowBorderBrush" Color="#4776cc"></SolidColorBrush>
<SolidColorBrush x:Key="defaultWindowBorderBrush1" Color="#478ccc"></SolidColorBrush>
<SolidColorBrush x:Key="defaultWindowBorderBrush2" Color="#153f8b"></SolidColorBrush>-->
<Style x:Key="WindowNoStyle" TargetType="{x:Type local:MyWindow}">
<Setter Property="AllowsTransparency" Value="true"/>
<Setter Property="Background" Value="Transparent"/>
<!--<Setter Property="FontFamily" Value="Consolas, Microsoft YaHei"/>
<Setter Property="FontSize" Value="24"/>-->
<Setter Property="ResizeMode" Value="NoResize"/>
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MyWindow}">
<Grid x:Name="windowGrid" Margin="10,0,10,10">
<Rectangle Fill="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
RadiusX="5" RadiusY="5">
<Rectangle.Effect>
<DropShadowEffect Direction="270" BlurRadius="10" ShadowDepth="5"/>
</Rectangle.Effect>
</Rectangle>
<Border x:Name="resize" Visibility="Hidden" Panel.ZIndex="10" Background="White" Opacity="0.1" Width="5" Height="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" />
<!--<Border CornerRadius="5,5,0,0" BorderBrush="{DynamicResource defaultWindowBorderBrush2}" BorderThickness="1">
<Border CornerRadius="5,5,0,0" BorderBrush="{DynamicResource defaultWindowBorderBrush1}" BorderThickness="1">-->
<Border CornerRadius="5,5,0,0" BorderBrush="{TemplateBinding BannerBackground}" BorderThickness="3" >
<DockPanel>
<Grid x:Name="titleGrid" DockPanel.Dock="Top" Height="25" Background="{TemplateBinding BannerBackground}">
<Button Style="{StaticResource bannerBtn}" Name="btnMin" Margin="0,0,60,0" Template="{StaticResource btnMinCT}" />
<Button Style="{StaticResource bannerBtn}" Name="btnMax" IsEnabled="{TemplateBinding BtnMaxFlag}" Margin="0,0,35,0" Template="{StaticResource btnMaxCT}" />
<Button Style="{StaticResource bannerBtn}" Name="btnClose" Margin="0,0,10,0" Template="{StaticResource btnCloseCT}" />
<TextBlock Style="{x:Null}" x:Name="tBTitle" FontSize="15" FontWeight="Bold" Text="{TemplateBinding WindowTitle}" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
<ContentPresenter />
</DockPanel>
</Border>
<!--</Border>
</Border>-->
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>