프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / Resources / WindowStyle.xaml @ 4fcb686a

이력 | 보기 | 이력해설 | 다운로드 (16.4 KB)

1
<ResourceDictionary
2
    x:Class="KCOM.Controls.CustomizedWindow.VS2012WindowStyle"
3
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5
    xmlns:cWin="clr-namespace:KCOM.Controls.CustomizedWindow"
6
    xmlns:local="clr-namespace:KCOM.Controls">
7

    
8
    <SolidColorBrush x:Key="TitleBarBackgroundBrush" Color="#FF2A579A" />
9
    <SolidColorBrush x:Key="VS2012WindowBorderBrush" Color="#007ACC" />
10
    <SolidColorBrush x:Key="VS2012WindowBorderBrushInactive" Color="#999999" />
11
    <SolidColorBrush x:Key="VS2012WindowStatusForeground" Color="#FFFFFF" />
12
    <SolidColorBrush x:Key="VS2012WindowStatusForegroundInactive" Color="#FFFFFF" />
13
    <Visibility x:Key="GripVisible">Visible</Visibility>
14
    <Style x:Key="VS2012WindowStyleTitleBarButton" TargetType="{x:Type Button}">
15
        <Setter Property="Focusable" Value="false" />
16
        <Setter Property="Foreground" Value="White" />
17
        <Setter Property="Template">
18
            <Setter.Value>
19
                <ControlTemplate TargetType="{x:Type Button}">
20
                    <Grid>
21
                        <Border x:Name="PART_border" Background="Transparent" />
22
                        <ContentPresenter />
23
                    </Grid>
24
                    <ControlTemplate.Triggers>
25
                        <Trigger Property="IsMouseOver" Value="True">
26
                            <Setter TargetName="PART_border" Property="Background" Value="#FFF" />
27
                            <Setter TargetName="PART_border" Property="Opacity" Value="0.7" />
28
                        </Trigger>
29
                        <Trigger Property="IsPressed" Value="True">
30
                            <Setter TargetName="PART_border" Property="Background" Value="{StaticResource VS2012WindowBorderBrush}" />
31
                            <Setter TargetName="PART_border" Property="Opacity" Value="1" />
32
                            <Setter Property="Foreground" Value="#FFF" />
33
                        </Trigger>
34
                    </ControlTemplate.Triggers>
35
                </ControlTemplate>
36
            </Setter.Value>
37
        </Setter>
38
    </Style>
39

    
40
    <Style x:Key="VS2012WindowStyle" TargetType="{x:Type cWin:CustomWindow}">
41
        <Setter Property="AllowsTransparency" Value="true" />
42
        <Setter Property="WindowStyle" Value="None" />
43
        <Setter Property="Background" Value="Transparent" />
44
        <Setter Property="ResizeMode" Value="CanResizeWithGrip" />
45
        <Setter Property="Foreground" Value="White" />
46
        <Setter Property="Template">
47
            <Setter.Value>
48
                <ControlTemplate TargetType="{x:Type cWin:CustomWindow}">
49
                    <!--
50
                        7 is a magic number. By default Windows fits a maximized window with Margin
51
                        7 7 7 7 to fill entire screen (WPF .Net 4.5). Larger numbers produce a gap
52
                        between maximized window and screen edges; smaller numbers show parts of
53
                        the window outside of the current monitor on multi-display computers.
54
                    -->
55
                    <Grid TextOptions.TextFormattingMode="Ideal" TextOptions.TextRenderingMode="Auto">
56
                        <Border
57
                            x:Name="PART_Border"
58
                            Width="Auto"
59
                            Height="Auto"
60
                            Padding="0"
61
                            Background="#1B1811"
62
                            BorderBrush="#FF1D2D44"
63
                            BorderThickness="1">
64
                            <Border BorderBrush="#FF293C57" BorderThickness="2">
65
                                <DockPanel
66
                                    HorizontalAlignment="Stretch"
67
                                    VerticalAlignment="Stretch"
68
                                    Background="Transparent">
69
                                    <Border
70
                                        x:Name="TitleBar"
71
                                        Background="{StaticResource TitleBarBackgroundBrush}"
72
                                        BorderThickness="0"
73
                                        DockPanel.Dock="Top"
74
                                        MouseLeftButtonDown="TitleBarMouseLeftButtonDown"
75
                                        MouseMove="TitleBarMouseMove">
76
                                        <Grid Height="32">
77
                                            <Grid.ColumnDefinitions>
78
                                                <ColumnDefinition Width="36" />
79
                                                <ColumnDefinition />
80
                                                <ColumnDefinition Width="34" />
81
                                                <ColumnDefinition Width="34" />
82
                                                <ColumnDefinition Width="34" />
83
                                            </Grid.ColumnDefinitions>
84
                                            <Image
85
                                                x:Name="Icon"
86
                                                Grid.Column="0"
87
                                                Width="32"
88
                                                Height="32"
89
                                                Margin="4,-7,0,7"
90
                                                HorizontalAlignment="Right"
91
                                                MouseLeftButtonDown="IconMouseLeftButtonDown"
92
                                                Source="{Binding Path=Icon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
93
                                            <TextBlock
94
                                                x:Name="Caption"
95
                                                Grid.Column="1"
96
                                                Margin="4,0,0,0"
97
                                                HorizontalAlignment="Center"
98
                                                VerticalAlignment="Center"
99
                                                FontFamily="Segoe UI"
100
                                                FontSize="12"
101
                                                FontWeight="Bold"
102
                                                Foreground="White"
103
                                                Opacity="0.66"
104
                                                Text="{Binding Path=Title, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" />
105
                                            <Button
106
                                                x:Name="MinButton"
107
                                                Grid.Column="2"
108
                                                Width="34"
109
                                                Height="26"
110
                                                VerticalAlignment="Top"
111
                                                Click="MinButtonClick"
112
                                                Style="{StaticResource VS2012WindowStyleTitleBarButton}">
113
                                                <Grid MaxWidth="9" MaxHeight="9">
114
                                                    <Path
115
                                                        Data="M0,8 H8 M0,7 H8 M0,6 H8"
116
                                                        RenderOptions.EdgeMode="Aliased"
117
                                                        Stretch="None"
118
                                                        Stroke="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
119
                                                        StrokeThickness="1" />
120
                                                </Grid>
121
                                            </Button>
122
                                            <Button
123
                                                x:Name="MaxButton"
124
                                                Grid.Column="3"
125
                                                Width="34"
126
                                                Height="26"
127
                                                VerticalAlignment="Top"
128
                                                Click="MaxButtonClick"
129
                                                Style="{StaticResource VS2012WindowStyleTitleBarButton}">
130
                                                <Grid MaxWidth="9" MaxHeight="9">
131
                                                    <Path
132
                                                        x:Name="PART_MaxButton_Path"
133
                                                        Data="M0,0 H8 V8 H0 V0 M0,1 H8 M0,2 H8"
134
                                                        RenderOptions.EdgeMode="Aliased"
135
                                                        Stretch="None"
136
                                                        Stroke="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
137
                                                        StrokeThickness="1" />
138
                                                </Grid>
139
                                            </Button>
140
                                            <Button
141
                                                x:Name="CloseButton"
142
                                                Grid.Column="4"
143
                                                Width="34"
144
                                                Height="26"
145
                                                VerticalAlignment="Top"
146
                                                Click="CloseButtonClick"
147
                                                Style="{StaticResource VS2012WindowStyleTitleBarButton}">
148
                                                <Grid MaxWidth="9" MaxHeight="9">
149
                                                    <Path
150
                                                        Data="M0,0 L8,8 M0,8 L8,0"
151
                                                        Stretch="None"
152
                                                        Stroke="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"
153
                                                        StrokeThickness="1.5" />
154
                                                </Grid>
155
                                            </Button>
156
                                        </Grid>
157
                                    </Border>
158
                                    <ContentPresenter />
159
                                </DockPanel>
160
                            </Border>
161
                        </Border>
162
                        <Line
163
                            x:Name="lnSizeNorth"
164
                            Cursor="SizeNS"
165
                            MouseDown="OnSizeNorth"
166
                            Stroke="Transparent"
167
                            StrokeThickness="4"
168
                            X1="1"
169
                            X2="{TemplateBinding ActualWidth}"
170
                            Y1="1"
171
                            Y2="1" />
172
                        <Line
173
                            x:Name="lnSizeSouth"
174
                            VerticalAlignment="Bottom"
175
                            Cursor="SizeNS"
176
                            MouseDown="OnSizeSouth"
177
                            Stroke="Transparent"
178
                            StrokeThickness="4"
179
                            X1="1"
180
                            X2="{TemplateBinding ActualWidth}"
181
                            Y1="{TemplateBinding ActualHeight}"
182
                            Y2="{TemplateBinding ActualHeight}" />
183
                        <Line
184
                            x:Name="lnSizeWest"
185
                            Cursor="SizeWE"
186
                            MouseDown="OnSizeWest"
187
                            Stroke="Transparent"
188
                            StrokeThickness="4"
189
                            X1="1"
190
                            X2="1"
191
                            Y1="1"
192
                            Y2="{TemplateBinding ActualHeight}" />
193
                        <Line
194
                            x:Name="lnSizeEast"
195
                            HorizontalAlignment="Right"
196
                            Cursor="SizeWE"
197
                            MouseDown="OnSizeEast"
198
                            Stroke="Transparent"
199
                            StrokeThickness="4"
200
                            X1="{TemplateBinding ActualWidth}"
201
                            X2="{TemplateBinding ActualWidth}"
202
                            Y1="1"
203
                            Y2="{TemplateBinding ActualHeight}" />
204
                        <Rectangle
205
                            x:Name="rectSizeNorthWest"
206
                            Width="5"
207
                            Height="5"
208
                            HorizontalAlignment="Left"
209
                            VerticalAlignment="Top"
210
                            Cursor="SizeNWSE"
211
                            Fill="Transparent"
212
                            MouseDown="OnSizeNorthWest" />
213
                        <Rectangle
214
                            x:Name="rectSizeNorthEast"
215
                            Width="5"
216
                            Height="5"
217
                            HorizontalAlignment="Right"
218
                            VerticalAlignment="Top"
219
                            Cursor="SizeNESW"
220
                            Fill="Transparent"
221
                            MouseDown="OnSizeNorthEast" />
222
                        <Rectangle
223
                            x:Name="rectSizeSouthWest"
224
                            Width="5"
225
                            Height="5"
226
                            HorizontalAlignment="Left"
227
                            VerticalAlignment="Bottom"
228
                            Cursor="SizeNESW"
229
                            Fill="Transparent"
230
                            MouseDown="OnSizeSouthWest" />
231
                        <Rectangle
232
                            x:Name="rectSizeSouthEast"
233
                            Width="5"
234
                            Height="5"
235
                            HorizontalAlignment="Right"
236
                            VerticalAlignment="Bottom"
237
                            Cursor="SizeNWSE"
238
                            Fill="Transparent"
239
                            MouseDown="OnSizeSouthEast" />
240
                    </Grid>
241
                    <ControlTemplate.Triggers>
242
                        <Trigger Property="CustomState" Value="Maximized">
243
                            <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" />
244
                            <Setter TargetName="lnSizeNorth" Property="Visibility" Value="Hidden" />
245
                            <Setter TargetName="lnSizeSouth" Property="Visibility" Value="Hidden" />
246
                            <Setter TargetName="lnSizeWest" Property="Visibility" Value="Hidden" />
247
                            <Setter TargetName="lnSizeEast" Property="Visibility" Value="Hidden" />
248
                            <Setter TargetName="rectSizeNorthWest" Property="Visibility" Value="Hidden" />
249
                            <Setter TargetName="rectSizeNorthEast" Property="Visibility" Value="Hidden" />
250
                            <Setter TargetName="rectSizeSouthWest" Property="Visibility" Value="Hidden" />
251
                            <Setter TargetName="rectSizeSouthEast" Property="Visibility" Value="Hidden" />
252
                        </Trigger>
253
                        <Trigger Property="IsActive" Value="False">
254
                            <Setter TargetName="PART_Border" Property="BorderBrush" Value="#54626F" />
255
                        </Trigger>
256
                    </ControlTemplate.Triggers>
257
                </ControlTemplate>
258
            </Setter.Value>
259
        </Setter>
260
        <Style.Resources>
261
            <Style TargetType="{x:Type StatusBar}">
262
                <Style.Triggers>
263
                    <DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="True">
264
                        <Setter Property="Foreground" Value="{StaticResource VS2012WindowStatusForeground}" />
265
                        <Setter Property="Background" Value="{StaticResource VS2012WindowBorderBrush}" />
266
                    </DataTrigger>
267
                    <DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="False">
268
                        <Setter Property="Foreground" Value="{StaticResource VS2012WindowStatusForegroundInactive}" />
269
                        <Setter Property="Background" Value="{StaticResource VS2012WindowBorderBrushInactive}" />
270
                    </DataTrigger>
271
                </Style.Triggers>
272
            </Style>
273
        </Style.Resources>
274
    </Style>
275
</ResourceDictionary>
클립보드 이미지 추가 (최대 크기: 500 MB)