프로젝트

일반

사용자정보

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

markus / KCOM / Resources / WindowStyle.xaml @ d21e9c15

이력 | 보기 | 이력해설 | 다운로드 (15.5 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:cWin="clr-namespace:KCOM.Controls.CustomizedWindow"
5
                    xmlns:local="clr-namespace:KCOM.Controls">
6

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

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