markus / KCOM / Resources / WindowStyle.xaml @ c5519c44
이력 | 보기 | 이력해설 | 다운로드 (15.8 KB)
1 |
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
---|---|
2 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
3 |
x:Class="KCOM.Controls.CustomizedWindow.VS2012WindowStyle" |
4 |
xmlns:local="clr-namespace:KCOM.Controls"> |
5 |
|
6 |
<SolidColorBrush x:Key="TitleBarBackgroundBrush" Color="#FF2A579A" /> |
7 |
<SolidColorBrush x:Key="VS2012WindowBorderBrush" Color="#007ACC" /> |
8 |
<SolidColorBrush x:Key="VS2012WindowBorderBrushInactive" Color="#999999" /> |
9 |
<SolidColorBrush x:Key="VS2012WindowStatusForeground" Color="#FFFFFF" /> |
10 |
<SolidColorBrush x:Key="VS2012WindowStatusForegroundInactive" Color="#FFFFFF" /> |
11 |
<Visibility x:Key="GripVisible">Visible</Visibility> |
12 |
<Style x:Key="VS2012WindowStyleTitleBarButton" TargetType="{x:Type Button}"> |
13 |
<Setter Property="Focusable" Value="false" /> |
14 |
<Setter Property="Foreground" Value="White"/> |
15 |
<Setter Property="Template"> |
16 |
<Setter.Value>
|
17 |
<ControlTemplate TargetType="{x:Type Button}"> |
18 |
<Grid>
|
19 |
<Border
|
20 |
x:Name="PART_border" |
21 |
Background="Transparent" |
22 |
/>
|
23 |
<ContentPresenter /> |
24 |
</Grid>
|
25 |
<ControlTemplate.Triggers>
|
26 |
<Trigger Property="IsMouseOver" Value="True"> |
27 |
<Setter TargetName="PART_border" Property="Background" Value="#FFF" /> |
28 |
<Setter TargetName="PART_border" Property="Opacity" Value="0.7" /> |
29 |
</Trigger>
|
30 |
<Trigger Property="IsPressed" Value="True"> |
31 |
<Setter TargetName="PART_border" Property="Background" Value="{StaticResource VS2012WindowBorderBrush}"/> |
32 |
<Setter TargetName="PART_border" Property="Opacity" Value="1" /> |
33 |
<Setter Property="Foreground" Value="#FFF"/> |
34 |
</Trigger>
|
35 |
</ControlTemplate.Triggers>
|
36 |
</ControlTemplate>
|
37 |
</Setter.Value>
|
38 |
</Setter>
|
39 |
</Style>
|
40 |
|
41 |
<Style x:Key="VS2012WindowStyle" TargetType="{x:Type Window}"> |
42 |
<Setter Property="AllowsTransparency" Value="true" /> |
43 |
<Setter Property="WindowStyle" Value="None" /> |
44 |
<Setter Property="Background" Value="Transparent" /> |
45 |
<Setter Property="ResizeMode" Value="CanResizeWithGrip" /> |
46 |
<Setter Property="Foreground" Value="White"/> |
47 |
<Setter Property="Template"> |
48 |
<Setter.Value>
|
49 |
<ControlTemplate TargetType="{x:Type Window}"> |
50 |
<!--
|
51 |
7 is a magic number. By default Windows fits a maximized window with Margin
|
52 |
7 7 7 7 to fill entire screen (WPF .Net 4.5). Larger numbers produce a gap
|
53 |
between maximized window and screen edges; smaller numbers show parts of
|
54 |
the window outside of the current monitor on multi-display computers.
|
55 |
-->
|
56 |
<Grid
|
57 |
Margin="7" |
58 |
TextOptions.TextRenderingMode="ClearType" |
59 |
TextOptions.TextFormattingMode="Display"> |
60 |
<Border
|
61 |
x:Name="PART_Border" |
62 |
Width="Auto" |
63 |
Height="Auto" |
64 |
Background="#EFEFF2" |
65 |
BorderBrush="{StaticResource VS2012WindowBorderBrush}" |
66 |
BorderThickness="1" |
67 |
Padding="0"> |
68 |
<Border.Effect>
|
69 |
<DropShadowEffect
|
70 |
Color="black" |
71 |
Opacity="0.5" |
72 |
BlurRadius="7" |
73 |
ShadowDepth="2" |
74 |
Direction="315"/> |
75 |
</Border.Effect>
|
76 |
<DockPanel
|
77 |
HorizontalAlignment="Stretch" |
78 |
Background="Transparent" |
79 |
VerticalAlignment="Stretch" |
80 |
>
|
81 |
<Border
|
82 |
x:Name="TitleBar" |
83 |
DockPanel.Dock="Top" |
84 |
Background="{StaticResource TitleBarBackgroundBrush}" |
85 |
BorderThickness="0" |
86 |
MouseLeftButtonDown="TitleBarMouseLeftButtonDown" |
87 |
MouseMove="TitleBarMouseMove" |
88 |
>
|
89 |
<Grid Height="32"> |
90 |
<Grid.ColumnDefinitions>
|
91 |
<ColumnDefinition Width="36"/> |
92 |
<ColumnDefinition /> |
93 |
<ColumnDefinition Width="34"/> |
94 |
<ColumnDefinition Width="34"/> |
95 |
<ColumnDefinition Width="34"/> |
96 |
</Grid.ColumnDefinitions>
|
97 |
<Image
|
98 |
x:Name="Icon" |
99 |
Grid.Column="0" |
100 |
Source="{Binding Path=Icon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" |
101 |
HorizontalAlignment="Right" |
102 |
Margin="4,-7,0,7" |
103 |
Width="32" |
104 |
Height="32" |
105 |
MouseLeftButtonDown="IconMouseLeftButtonDown" |
106 |
/>
|
107 |
<TextBlock
|
108 |
x:Name="Caption" |
109 |
Grid.Column="1" |
110 |
HorizontalAlignment="Center" |
111 |
VerticalAlignment="Center" |
112 |
Margin="4,0,0,0" |
113 |
FontFamily="Segoe UI" |
114 |
FontSize="12" |
115 |
FontWeight="Bold" |
116 |
Foreground="White" |
117 |
Opacity="0.66" |
118 |
Text="{Binding Path=Title, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" |
119 |
/>
|
120 |
<Button
|
121 |
x:Name="MinButton" |
122 |
Grid.Column="2" |
123 |
VerticalAlignment="Top" |
124 |
Width="34" |
125 |
Height="26" |
126 |
Style="{StaticResource VS2012WindowStyleTitleBarButton}" |
127 |
Click="MinButtonClick" |
128 |
>
|
129 |
<Grid MaxHeight="9" MaxWidth="9"> |
130 |
<Path
|
131 |
Stroke="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}" |
132 |
StrokeThickness="1" |
133 |
Stretch="None" |
134 |
RenderOptions.EdgeMode="Aliased" |
135 |
Data="M0,8 H8 M0,7 H8 M0,6 H8" |
136 |
/>
|
137 |
</Grid>
|
138 |
</Button>
|
139 |
<Button
|
140 |
Grid.Column="3" |
141 |
x:Name="MaxButton" |
142 |
VerticalAlignment="Top" |
143 |
Width="34" |
144 |
Height="26" |
145 |
Style="{StaticResource VS2012WindowStyleTitleBarButton}" |
146 |
Click="MaxButtonClick" |
147 |
>
|
148 |
<Grid MaxHeight="9" MaxWidth="9"> |
149 |
<Path
|
150 |
x:Name="PART_MaxButton_Path" |
151 |
Stroke="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}" |
152 |
StrokeThickness="1" |
153 |
Stretch="None" |
154 |
RenderOptions.EdgeMode="Aliased" |
155 |
Data="M0,0 H8 V8 H0 V0 M0,1 H8 M0,2 H8" |
156 |
/>
|
157 |
</Grid>
|
158 |
</Button>
|
159 |
<Button
|
160 |
Grid.Column="4" |
161 |
x:Name="CloseButton" |
162 |
VerticalAlignment="Top" |
163 |
Width="34" |
164 |
Height="26" |
165 |
Style="{StaticResource VS2012WindowStyleTitleBarButton}" |
166 |
Click="CloseButtonClick" |
167 |
>
|
168 |
<Grid MaxHeight="9" MaxWidth="9"> |
169 |
<Path
|
170 |
Stroke="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}" |
171 |
StrokeThickness="1.5" |
172 |
Stretch="None" |
173 |
Data="M0,0 L8,8 M0,8 L8,0" |
174 |
/>
|
175 |
</Grid>
|
176 |
</Button>
|
177 |
</Grid>
|
178 |
</Border>
|
179 |
<ContentPresenter /> |
180 |
</DockPanel>
|
181 |
</Border>
|
182 |
<Line
|
183 |
MouseDown="OnSizeNorth" |
184 |
x:Name="lnSizeNorth" |
185 |
Stroke="Transparent" |
186 |
Cursor="SizeNS" |
187 |
X1="1" X2="{TemplateBinding ActualWidth}" Y1="1" Y2="1" |
188 |
StrokeThickness="3" |
189 |
/>
|
190 |
<Line
|
191 |
MouseDown="OnSizeSouth" |
192 |
x:Name="lnSizeSouth" |
193 |
Stroke="Transparent" |
194 |
VerticalAlignment="Bottom" |
195 |
Cursor="SizeNS" |
196 |
X1="1" X2="{TemplateBinding ActualWidth}" Y1="{TemplateBinding ActualHeight}" Y2="{TemplateBinding ActualHeight}" |
197 |
StrokeThickness="3" |
198 |
/>
|
199 |
<Line
|
200 |
MouseDown="OnSizeWest" |
201 |
x:Name="lnSizeWest" |
202 |
Stroke="Transparent" |
203 |
Cursor="SizeWE" |
204 |
X1="1" X2="1" Y1="1" Y2="{TemplateBinding ActualHeight}" |
205 |
StrokeThickness="3" |
206 |
/>
|
207 |
<Line
|
208 |
MouseDown="OnSizeEast" |
209 |
x:Name="lnSizeEast" |
210 |
Stroke="Transparent" |
211 |
HorizontalAlignment="Right" |
212 |
Cursor="SizeWE" |
213 |
X1="{TemplateBinding ActualWidth}" X2="{TemplateBinding ActualWidth}" Y1="1" Y2="{TemplateBinding ActualHeight}" |
214 |
StrokeThickness="3" |
215 |
/>
|
216 |
<Rectangle MouseDown="OnSizeNorthWest" x:Name="rectSizeNorthWest" Cursor="SizeNWSE" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Top" HorizontalAlignment="Left" /> |
217 |
<Rectangle MouseDown="OnSizeNorthEast" x:Name="rectSizeNorthEast" Cursor="SizeNESW" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Top" HorizontalAlignment="Right" /> |
218 |
<Rectangle MouseDown="OnSizeSouthWest" x:Name="rectSizeSouthWest" Cursor="SizeNESW" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Bottom" HorizontalAlignment="Left" /> |
219 |
<Rectangle MouseDown="OnSizeSouthEast" x:Name="rectSizeSouthEast" Cursor="SizeNWSE" Fill="Transparent" Width="5" Height="5" VerticalAlignment="Bottom" HorizontalAlignment="Right" /> |
220 |
</Grid>
|
221 |
<ControlTemplate.Triggers>
|
222 |
<Trigger Property="WindowState" Value="Maximized"> |
223 |
<Setter TargetName="PART_MaxButton_Path" Property="Data" Value="M0,3 H5 V8 H0 V3 M0,4 H5 M3,0 H8 V5 H7 M3,1 H8"/> |
224 |
<Setter TargetName="lnSizeNorth" Property="Cursor" Value="None"/> |
225 |
<Setter TargetName="lnSizeSouth" Property="Cursor" Value="None"/> |
226 |
<Setter TargetName="lnSizeWest" Property="Cursor" Value="None"/> |
227 |
<Setter TargetName="lnSizeEast" Property="Cursor" Value="None"/> |
228 |
<Setter TargetName="rectSizeNorthWest" Property="Cursor" Value="None"/> |
229 |
<Setter TargetName="rectSizeNorthEast" Property="Cursor" Value="None"/> |
230 |
<Setter TargetName="rectSizeSouthWest" Property="Cursor" Value="None"/> |
231 |
<Setter TargetName="rectSizeSouthEast" Property="Cursor" Value="None"/> |
232 |
</Trigger>
|
233 |
<Trigger Property="IsActive" Value="False"> |
234 |
<Setter TargetName="PART_Border" Property="BorderBrush" Value="{StaticResource VS2012WindowBorderBrushInactive}"/> |
235 |
</Trigger>
|
236 |
</ControlTemplate.Triggers>
|
237 |
</ControlTemplate>
|
238 |
</Setter.Value>
|
239 |
</Setter>
|
240 |
<Style.Resources>
|
241 |
<Style TargetType="{x:Type StatusBar}"> |
242 |
<Style.Triggers>
|
243 |
<DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="True"> |
244 |
<Setter Property="Foreground" Value="{StaticResource VS2012WindowStatusForeground}" /> |
245 |
<Setter Property="Background" Value="{StaticResource VS2012WindowBorderBrush}" /> |
246 |
</DataTrigger>
|
247 |
<DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="False"> |
248 |
<Setter Property="Foreground" Value="{StaticResource VS2012WindowStatusForegroundInactive}" /> |
249 |
<Setter Property="Background" Value="{StaticResource VS2012WindowBorderBrushInactive}" /> |
250 |
</DataTrigger>
|
251 |
</Style.Triggers>
|
252 |
</Style>
|
253 |
</Style.Resources>
|
254 |
</Style>
|
255 |
</ResourceDictionary>
|