Skip to content

Commit 3bd130a

Browse files
committed
Update Generic.xaml
1 parent 14cdd37 commit 3bd130a

File tree

1 file changed

+121
-80
lines changed

1 file changed

+121
-80
lines changed

src/WPFDevelopers.Net45x/Themes/Generic.xaml

Lines changed: 121 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,177 @@
1-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:wpfdev="clr-namespace:WPFDevelopers.Net45x"
4-
xmlns:converts="clr-namespace:WPFDevelopers.Converts">
5-
6-
7-
<converts:ObjectNullToVisibilityConverter x:Key="ObjectNullToVisibilityConverter"/>
8-
<Style x:Key="WPFDevelopersWindow" TargetType="{x:Type wpfdev:Window}" BasedOn="{x:Null}">
1+
<ResourceDictionary
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:converts="clr-namespace:WPFDevelopers.Converts"
5+
xmlns:wpfdev="clr-namespace:WPFDevelopers.Net45x">
6+
<converts:ObjectNullToVisibilityConverter x:Key="ObjectNullToVisibilityConverter" />
7+
<Style
8+
x:Key="WPFDevelopersWindow"
9+
BasedOn="{x:Null}"
10+
TargetType="{x:Type wpfdev:Window}">
911
<Setter Property="Foreground" Value="{DynamicResource WD.WindowForegroundColorBrush}" />
10-
<Setter Property="Background" Value="{DynamicResource WD.BackgroundSolidColorBrush}" />
12+
<Setter Property="Background" Value="{DynamicResource WD.BackgroundSolidColorBrush}" />
1113
<Setter Property="BorderBrush" Value="{DynamicResource WD.WindowBorderBrushSolidColorBrush}" />
12-
<Setter Property="BorderThickness" Value="1"/>
13-
<Setter Property="IsTabStop" Value="False" />
14-
<!--<Setter Property="ResizeMode" Value="CanResizeWithGrip" />-->
15-
<Setter Property="SnapsToDevicePixels" Value="True"/>
14+
<Setter Property="BorderThickness" Value="1" />
15+
<Setter Property="IsTabStop" Value="False" />
16+
<Setter Property="SnapsToDevicePixels" Value="True" />
1617
<Setter Property="UseLayoutRounding" Value="True" />
1718
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
18-
<Setter Property="WindowStyle" Value="None" />
19-
<Setter Property="MaxHeight" Value="{x:Static SystemParameters.MaximizedPrimaryScreenHeight}"/>
20-
<Setter Property="MaxWidth" Value="{x:Static SystemParameters.MaximizedPrimaryScreenWidth}"/>
19+
<Setter Property="WindowStyle" Value="None" />
20+
<Setter Property="MaxHeight" Value="{x:Static SystemParameters.MaximizedPrimaryScreenHeight}" />
21+
<Setter Property="MaxWidth" Value="{x:Static SystemParameters.MaximizedPrimaryScreenWidth}" />
2122
<Setter Property="FontFamily" Value="{DynamicResource WD.NormalFontFamily}" />
2223
<Setter Property="WindowChrome.WindowChrome">
2324
<Setter.Value>
24-
<WindowChrome GlassFrameThickness="0,0,0,.1"
25-
UseAeroCaptionButtons="False"
26-
CaptionHeight="{Binding TitleHeight,RelativeSource={RelativeSource AncestorType=wpfdev:Window}}"/>
25+
<WindowChrome
26+
CaptionHeight="{Binding TitleHeight, RelativeSource={RelativeSource AncestorType=wpfdev:Window}}"
27+
GlassFrameThickness="0,0,0,.1"
28+
UseAeroCaptionButtons="False" />
2729
</Setter.Value>
2830
</Setter>
2931
<Setter Property="Template">
3032
<Setter.Value>
3133
<ControlTemplate TargetType="{x:Type wpfdev:Window}">
32-
<Border SnapsToDevicePixels="True"
33-
BorderBrush="{TemplateBinding BorderBrush}"
34-
BorderThickness="{TemplateBinding BorderThickness}">
35-
<Grid Background="{TemplateBinding Background}"
36-
x:Name="LayoutRoot">
34+
<Border
35+
BorderBrush="{TemplateBinding BorderBrush}"
36+
BorderThickness="{TemplateBinding BorderThickness}"
37+
SnapsToDevicePixels="True">
38+
<Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}">
3739
<Grid.RowDefinitions>
3840
<RowDefinition Height="Auto" />
3941
<RowDefinition Height="*" />
4042
</Grid.RowDefinitions>
41-
<Grid Grid.Row="0" Height="{TemplateBinding TitleHeight}"
42-
Background="{TemplateBinding BorderBrush}">
43+
<Grid
44+
Grid.Row="0"
45+
Height="{TemplateBinding TitleHeight}"
46+
Background="{TemplateBinding BorderBrush}">
4347
<Grid.ColumnDefinitions>
4448
<ColumnDefinition Width="Auto" />
4549
<ColumnDefinition Width="*" />
46-
<ColumnDefinition Width="Auto" MinWidth="30"/>
50+
<ColumnDefinition Width="Auto" MinWidth="30" />
4751
</Grid.ColumnDefinitions>
48-
<Image Source="{TemplateBinding Icon}" Stretch="Fill"
49-
VerticalAlignment="Center" HorizontalAlignment="Left" Width="30" Height="30" Margin="14,0,0,0"
52+
<Image
53+
Width="30"
54+
Height="30"
55+
Margin="14,0,0,0"
56+
HorizontalAlignment="Left"
57+
VerticalAlignment="Center"
5058
RenderOptions.BitmapScalingMode="HighQuality"
51-
Visibility="{TemplateBinding Icon,Converter={StaticResource ObjectNullToVisibilityConverter}}"/>
52-
<TextBlock Text="{TemplateBinding Title}" x:Name="PART_Title" Margin="6,0"
53-
Foreground="{TemplateBinding Foreground}" Grid.Column="1"
54-
VerticalAlignment="Center" FontSize="{DynamicResource WD.TitleFontSize}"/>
55-
<WrapPanel Grid.Column="2" WindowChrome.IsHitTestVisibleInChrome="True"
56-
Margin="0,6">
59+
Source="{TemplateBinding Icon}"
60+
Stretch="Fill"
61+
Visibility="{TemplateBinding Icon,
62+
Converter={StaticResource ObjectNullToVisibilityConverter}}" />
63+
<TextBlock
64+
x:Name="PART_Title"
65+
Grid.Column="1"
66+
Margin="6,0"
67+
VerticalAlignment="Center"
68+
FontSize="{DynamicResource WD.TitleFontSize}"
69+
Foreground="{TemplateBinding Foreground}"
70+
Text="{TemplateBinding Title}" />
71+
<WrapPanel
72+
Grid.Column="2"
73+
Margin="0,6"
74+
WindowChrome.IsHitTestVisibleInChrome="True">
5775
<WrapPanel x:Name="PART_MinAndMax">
58-
<Button Name="PART_MinimizeButton" IsTabStop="False" Padding="0"
59-
Style="{DynamicResource WD.WindowButtonStyle}"
60-
Command="SystemCommands.MinimizeWindowCommand">
76+
<Button
77+
Name="PART_MinimizeButton"
78+
Padding="0"
79+
Command="SystemCommands.MinimizeWindowCommand"
80+
IsTabStop="False"
81+
Style="{DynamicResource WD.WindowButtonStyle}">
6182
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
62-
<Rectangle x:Name="MinimizeGlyph" Width="10" Height="1" Margin="0 7 0 0"
63-
VerticalAlignment="Bottom" Fill="{TemplateBinding Foreground}" />
83+
<Rectangle
84+
x:Name="MinimizeGlyph"
85+
Width="10"
86+
Height="1"
87+
Margin="0,7,0,0"
88+
VerticalAlignment="Bottom"
89+
Fill="{TemplateBinding Foreground}" />
6490
</Grid>
6591
</Button>
66-
<Button Name="PART_MaximizeButton" IsTabStop="False" Padding="0"
67-
Style="{DynamicResource WD.WindowButtonStyle}"
68-
Command="SystemCommands.MaximizeWindowCommand">
92+
<Button
93+
Name="PART_MaximizeButton"
94+
Padding="0"
95+
Command="SystemCommands.MaximizeWindowCommand"
96+
IsTabStop="False"
97+
Style="{DynamicResource WD.WindowButtonStyle}">
6998
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
70-
<Path Width="10" Height="10"
71-
HorizontalAlignment="Center" VerticalAlignment="Center"
72-
Data="{DynamicResource WD.WindowMaximizeGeometry}" Fill="{TemplateBinding Foreground}"
73-
Stretch="Fill" UseLayoutRounding="False" />
99+
<Path
100+
Width="10"
101+
Height="10"
102+
HorizontalAlignment="Center"
103+
VerticalAlignment="Center"
104+
Data="{DynamicResource WD.WindowMaximizeGeometry}"
105+
Fill="{TemplateBinding Foreground}"
106+
Stretch="Fill"
107+
UseLayoutRounding="False" />
74108
</Grid>
75109
</Button>
76-
<Button Name="PART_RestoreButton" IsTabStop="False" Padding="0"
77-
Style="{DynamicResource WD.WindowButtonStyle}"
110+
<Button
111+
Name="PART_RestoreButton"
112+
Padding="0"
78113
Command="SystemCommands.RestoreWindowCommand"
114+
IsTabStop="False"
115+
Style="{DynamicResource WD.WindowButtonStyle}"
79116
Visibility="Collapsed">
80117
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
81-
<Path Width="10" Height="10"
82-
HorizontalAlignment="Center" VerticalAlignment="Center"
83-
Data="{DynamicResource WD.WindowRestoreGeometry}" Fill="{TemplateBinding Foreground}"
84-
Stretch="Fill" UseLayoutRounding="False" />
118+
<Path
119+
Width="10"
120+
Height="10"
121+
HorizontalAlignment="Center"
122+
VerticalAlignment="Center"
123+
Data="{DynamicResource WD.WindowRestoreGeometry}"
124+
Fill="{TemplateBinding Foreground}"
125+
Stretch="Fill"
126+
UseLayoutRounding="False" />
85127
</Grid>
86128
</Button>
87129
</WrapPanel>
88130

89-
<Button Name="PART_CloseButton"
90-
IsTabStop="False" Style="{DynamicResource WD.WindowButtonStyle}"
91-
Command="SystemCommands.CloseWindowCommand">
92-
<Path Width="10" Height="10"
93-
HorizontalAlignment="Center"
94-
VerticalAlignment="Center"
95-
Data="{DynamicResource WD.WindowCloseGeometry}"
96-
Fill="{TemplateBinding Foreground}"
97-
Stretch="Fill" />
131+
<Button
132+
Name="PART_CloseButton"
133+
Command="SystemCommands.CloseWindowCommand"
134+
IsTabStop="False"
135+
Style="{DynamicResource WD.WindowButtonStyle}">
136+
<Path
137+
Width="10"
138+
Height="10"
139+
HorizontalAlignment="Center"
140+
VerticalAlignment="Center"
141+
Data="{DynamicResource WD.WindowCloseGeometry}"
142+
Fill="{TemplateBinding Foreground}"
143+
Stretch="Fill" />
98144
</Button>
99145
</WrapPanel>
100146
</Grid>
101147
<AdornerDecorator Grid.Row="1" KeyboardNavigation.IsTabStop="False">
102-
<ContentPresenter x:Name="MainContentPresenter" ClipToBounds="True"/>
148+
<ContentPresenter x:Name="MainContentPresenter" ClipToBounds="True" />
103149
</AdornerDecorator>
104-
<ResizeGrip x:Name="ResizeGrip"
105-
HorizontalAlignment="Right"
106-
VerticalAlignment="Bottom"
107-
Grid.Row="1" IsTabStop="False"
108-
Visibility="Collapsed"/>
150+
<ResizeGrip
151+
x:Name="ResizeGrip"
152+
Grid.Row="1"
153+
HorizontalAlignment="Right"
154+
VerticalAlignment="Bottom"
155+
IsTabStop="False"
156+
Visibility="Collapsed" />
109157
</Grid>
110158
</Border>
111159
<ControlTemplate.Triggers>
112160
<Trigger Property="WindowState" Value="Maximized">
113-
<Setter Property="Visibility" Value="Visible" TargetName="PART_RestoreButton"/>
114-
<Setter Property="Visibility" Value="Collapsed" TargetName="PART_MaximizeButton"/>
115-
<Setter Property="Margin" TargetName="LayoutRoot" Value="7"/>
161+
<Setter TargetName="PART_RestoreButton" Property="Visibility" Value="Visible" />
162+
<Setter TargetName="PART_MaximizeButton" Property="Visibility" Value="Collapsed" />
163+
<Setter TargetName="LayoutRoot" Property="Margin" Value="7" />
116164
</Trigger>
117165
<Trigger Property="WindowStyle" Value="ToolWindow">
118166
<Setter TargetName="PART_MinAndMax" Property="Visibility" Value="Collapsed" />
119167
</Trigger>
120168
<MultiTrigger>
121169
<MultiTrigger.Conditions>
122-
<Condition Property="ResizeMode" Value="CanResizeWithGrip" />
123-
<Condition Property="WindowState" Value="Normal" />
170+
<Condition Property="ResizeMode" Value="CanResizeWithGrip" />
171+
<Condition Property="WindowState" Value="Normal" />
124172
</MultiTrigger.Conditions>
125173
<Setter TargetName="ResizeGrip" Property="Visibility" Value="Visible" />
126174
</MultiTrigger>
127-
<!--<MultiTrigger>
128-
<MultiTrigger.Conditions>
129-
<Condition Property="ResizeMode" Value="NoResize" />
130-
<Condition Property="WindowStyle" Value="ToolWindow" />
131-
</MultiTrigger.Conditions>
132-
<Setter TargetName="PART_MinAndMax" Property="Visibility" Value="Collapsed" />
133-
</MultiTrigger>-->
134175
</ControlTemplate.Triggers>
135176
</ControlTemplate>
136177
</Setter.Value>

0 commit comments

Comments
 (0)