Skip to content

Commit 1ba743d

Browse files
committed
Update Generic.xaml
1 parent e361dd3 commit 1ba743d

File tree

1 file changed

+115
-79
lines changed

1 file changed

+115
-79
lines changed

src/WPFDevelopers.Net40/Themes/Generic.xaml

Lines changed: 115 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,171 @@
1-
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3-
xmlns:shell="clr-namespace:Microsoft.Windows.Shell"
4-
xmlns:wpfdev="clr-namespace:WPFDevelopers.Net40"
5-
xmlns:converts="clr-namespace:WPFDevelopers.Converts">
6-
7-
<converts:ObjectNullToVisibilityConverter x:Key="ObjectNullToVisibilityConverter"/>
8-
9-
<Style 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:shell="clr-namespace:Microsoft.Windows.Shell"
6+
xmlns:wpfdev="clr-namespace:WPFDevelopers.Net40">
7+
<converts:ObjectNullToVisibilityConverter x:Key="ObjectNullToVisibilityConverter" />
8+
<Style BasedOn="{x:Null}" TargetType="{x:Type wpfdev:Window}">
109
<Setter Property="Foreground" Value="{DynamicResource WD.WindowForegroundColorBrush}" />
11-
<Setter Property="Background" Value="{DynamicResource WD.BackgroundSolidColorBrush}" />
10+
<Setter Property="Background" Value="{DynamicResource WD.BackgroundSolidColorBrush}" />
1211
<Setter Property="BorderBrush" Value="{DynamicResource WD.WindowBorderBrushSolidColorBrush}" />
13-
<Setter Property="IsTabStop" Value="False" />
14-
<Setter Property="BorderThickness" Value="1"/>
15-
<Setter Property="SnapsToDevicePixels" Value="True"/>
12+
<Setter Property="IsTabStop" Value="False" />
13+
<Setter Property="BorderThickness" Value="1" />
14+
<Setter Property="SnapsToDevicePixels" Value="True" />
1615
<Setter Property="UseLayoutRounding" Value="True" />
1716
<Setter Property="TextOptions.TextFormattingMode" Value="Ideal" />
18-
<Setter Property="WindowStyle" Value="None" />
19-
<Setter Property="MaxHeight" Value="{x:Static SystemParameters.MaximizedPrimaryScreenHeight}"/>
17+
<Setter Property="WindowStyle" Value="None" />
18+
<Setter Property="MaxHeight" Value="{x:Static SystemParameters.MaximizedPrimaryScreenHeight}" />
2019
<Setter Property="FontFamily" Value="{DynamicResource WD.NormalFontFamily}" />
2120
<Setter Property="shell:WindowChrome.WindowChrome">
2221
<Setter.Value>
23-
<shell:WindowChrome GlassFrameThickness="0,0,0,.1"
24-
CaptionHeight="{Binding TitleHeight,RelativeSource={RelativeSource AncestorType=wpfdev:Window}}"/>
22+
<shell:WindowChrome CaptionHeight="{Binding TitleHeight, RelativeSource={RelativeSource AncestorType=wpfdev:Window}}" GlassFrameThickness="0,0,0,.1" />
2523
</Setter.Value>
2624
</Setter>
2725
<Setter Property="Template">
2826
<Setter.Value>
2927
<ControlTemplate TargetType="{x:Type wpfdev:Window}">
30-
<Border SnapsToDevicePixels="True"
31-
BorderBrush="{TemplateBinding BorderBrush}"
32-
BorderThickness="{TemplateBinding BorderThickness}">
33-
<Grid Background="{TemplateBinding Background}"
34-
x:Name="LayoutRoot">
28+
<Border
29+
BorderBrush="{TemplateBinding BorderBrush}"
30+
BorderThickness="{TemplateBinding BorderThickness}"
31+
SnapsToDevicePixels="True">
32+
<Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}">
3533
<Grid.RowDefinitions>
3634
<RowDefinition Height="Auto" />
3735
<RowDefinition Height="*" />
3836
</Grid.RowDefinitions>
39-
<Grid Grid.Row="0" Height="{TemplateBinding TitleHeight}"
40-
Background="{TemplateBinding BorderBrush}">
37+
<Grid
38+
Grid.Row="0"
39+
Height="{TemplateBinding TitleHeight}"
40+
Background="{TemplateBinding BorderBrush}">
4141
<Grid.ColumnDefinitions>
4242
<ColumnDefinition Width="Auto" />
4343
<ColumnDefinition Width="*" />
44-
<ColumnDefinition Width="Auto" MinWidth="30"/>
44+
<ColumnDefinition Width="Auto" MinWidth="30" />
4545
</Grid.ColumnDefinitions>
46-
<Image Source="{TemplateBinding Icon}" Stretch="Fill"
47-
VerticalAlignment="Center" HorizontalAlignment="Left" Width="30" Height="30" Margin="14,0,0,0"
46+
<Image
47+
Width="30"
48+
Height="30"
49+
Margin="14,0,0,0"
50+
HorizontalAlignment="Left"
51+
VerticalAlignment="Center"
4852
RenderOptions.BitmapScalingMode="HighQuality"
49-
Visibility="{TemplateBinding Icon,Converter={StaticResource ObjectNullToVisibilityConverter}}"/>
50-
<TextBlock Text="{TemplateBinding Title}" x:Name="PART_Title" Margin="6,0"
51-
Foreground="{TemplateBinding Foreground}" Grid.Column="1"
52-
VerticalAlignment="Center" FontSize="{DynamicResource WD.TitleFontSize}"/>
53-
<WrapPanel Grid.Column="2" shell:WindowChrome.IsHitTestVisibleInChrome="True"
54-
Margin="0,6">
53+
Source="{TemplateBinding Icon}"
54+
Stretch="Fill"
55+
Visibility="{TemplateBinding Icon,
56+
Converter={StaticResource ObjectNullToVisibilityConverter}}" />
57+
<TextBlock
58+
x:Name="PART_Title"
59+
Grid.Column="1"
60+
Margin="6,0"
61+
VerticalAlignment="Center"
62+
FontSize="{DynamicResource WD.TitleFontSize}"
63+
Foreground="{TemplateBinding Foreground}"
64+
Text="{TemplateBinding Title}" />
65+
<WrapPanel
66+
Grid.Column="2"
67+
Margin="0,6"
68+
shell:WindowChrome.IsHitTestVisibleInChrome="True">
5569
<WrapPanel x:Name="PART_MinAndMax">
56-
<Button Name="PART_MinimizeButton" IsTabStop="False" Padding="0"
57-
Style="{DynamicResource WD.WindowButtonStyle}"
58-
Command="{Binding Source={x:Static shell:SystemCommands.MinimizeWindowCommand}}">
70+
<Button
71+
Name="PART_MinimizeButton"
72+
Padding="0"
73+
Command="{Binding Source={x:Static shell:SystemCommands.MinimizeWindowCommand}}"
74+
IsTabStop="False"
75+
Style="{DynamicResource WD.WindowButtonStyle}">
5976
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
60-
<Rectangle x:Name="MinimizeGlyph" Width="10" Height="1" Margin="0 7 0 0"
61-
VerticalAlignment="Bottom" Fill="{TemplateBinding Foreground}" />
77+
<Rectangle
78+
x:Name="MinimizeGlyph"
79+
Width="10"
80+
Height="1"
81+
Margin="0,7,0,0"
82+
VerticalAlignment="Bottom"
83+
Fill="{TemplateBinding Foreground}" />
6284
</Grid>
6385
</Button>
64-
<Button Name="PART_MaximizeButton" IsTabStop="False" Padding="0"
65-
Style="{DynamicResource WD.WindowButtonStyle}"
66-
Command="{Binding Source={x:Static shell:SystemCommands.MaximizeWindowCommand}}">
86+
<Button
87+
Name="PART_MaximizeButton"
88+
Padding="0"
89+
Command="{Binding Source={x:Static shell:SystemCommands.MaximizeWindowCommand}}"
90+
IsTabStop="False"
91+
Style="{DynamicResource WD.WindowButtonStyle}">
6792
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
68-
<Path Width="10" Height="10"
69-
HorizontalAlignment="Center" VerticalAlignment="Center"
70-
Data="{DynamicResource WD.WindowMaximizeGeometry}" Fill="{TemplateBinding Foreground}"
71-
Stretch="Fill" UseLayoutRounding="False" />
93+
<Path
94+
Width="10"
95+
Height="10"
96+
HorizontalAlignment="Center"
97+
VerticalAlignment="Center"
98+
Data="{DynamicResource WD.WindowMaximizeGeometry}"
99+
Fill="{TemplateBinding Foreground}"
100+
Stretch="Fill"
101+
UseLayoutRounding="False" />
72102
</Grid>
73103
</Button>
74-
<Button Name="PART_RestoreButton" IsTabStop="False" Padding="0"
75-
Style="{DynamicResource WD.WindowButtonStyle}"
104+
<Button
105+
Name="PART_RestoreButton"
106+
Padding="0"
76107
Command="{Binding Source={x:Static shell:SystemCommands.RestoreWindowCommand}}"
108+
IsTabStop="False"
109+
Style="{DynamicResource WD.WindowButtonStyle}"
77110
Visibility="Collapsed">
78111
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
79-
<Path Width="10" Height="10"
80-
HorizontalAlignment="Center" VerticalAlignment="Center"
81-
Data="{DynamicResource WD.WindowRestoreGeometry}" Fill="{TemplateBinding Foreground}"
82-
Stretch="Fill" UseLayoutRounding="False" />
112+
<Path
113+
Width="10"
114+
Height="10"
115+
HorizontalAlignment="Center"
116+
VerticalAlignment="Center"
117+
Data="{DynamicResource WD.WindowRestoreGeometry}"
118+
Fill="{TemplateBinding Foreground}"
119+
Stretch="Fill"
120+
UseLayoutRounding="False" />
83121
</Grid>
84122
</Button>
85123
</WrapPanel>
86124

87-
<Button Name="PART_CloseButton"
88-
IsTabStop="False" Style="{DynamicResource WD.WindowButtonStyle}"
89-
Command="{Binding Source={x:Static shell:SystemCommands.CloseWindowCommand}}">
90-
<Path Width="10" Height="10"
91-
HorizontalAlignment="Center"
92-
VerticalAlignment="Center"
93-
Data="{DynamicResource WD.WindowCloseGeometry}"
94-
Fill="{TemplateBinding Foreground}"
95-
Stretch="Fill" />
125+
<Button
126+
Name="PART_CloseButton"
127+
Command="{Binding Source={x:Static shell:SystemCommands.CloseWindowCommand}}"
128+
IsTabStop="False"
129+
Style="{DynamicResource WD.WindowButtonStyle}">
130+
<Path
131+
Width="10"
132+
Height="10"
133+
HorizontalAlignment="Center"
134+
VerticalAlignment="Center"
135+
Data="{DynamicResource WD.WindowCloseGeometry}"
136+
Fill="{TemplateBinding Foreground}"
137+
Stretch="Fill" />
96138
</Button>
97139
</WrapPanel>
98140
</Grid>
99141
<AdornerDecorator Grid.Row="1" KeyboardNavigation.IsTabStop="False">
100-
<ContentPresenter x:Name="MainContentPresenter" ClipToBounds="True"/>
142+
<ContentPresenter x:Name="MainContentPresenter" ClipToBounds="True" />
101143
</AdornerDecorator>
102-
<ResizeGrip x:Name="ResizeGrip"
103-
HorizontalAlignment="Right"
104-
VerticalAlignment="Bottom"
105-
Grid.Row="1" IsTabStop="False"
106-
Visibility="Collapsed"/>
144+
<ResizeGrip
145+
x:Name="ResizeGrip"
146+
Grid.Row="1"
147+
HorizontalAlignment="Right"
148+
VerticalAlignment="Bottom"
149+
IsTabStop="False"
150+
Visibility="Collapsed" />
107151
</Grid>
108152
</Border>
109153
<ControlTemplate.Triggers>
110154
<Trigger Property="WindowState" Value="Maximized">
111-
<Setter Property="Visibility" Value="Visible" TargetName="PART_RestoreButton"/>
112-
<Setter Property="Visibility" Value="Collapsed" TargetName="PART_MaximizeButton"/>
113-
<!--<Setter Property="BorderThickness" Value="{Binding Source={x:Static shell:SystemParameters2.Current}, Path=WindowResizeBorderThickness}"/>-->
114-
<Setter Property="Margin" TargetName="LayoutRoot" Value="7"/>
155+
<Setter TargetName="PART_RestoreButton" Property="Visibility" Value="Visible" />
156+
<Setter TargetName="PART_MaximizeButton" Property="Visibility" Value="Collapsed" />
157+
<Setter TargetName="LayoutRoot" Property="Margin" Value="7" />
115158
</Trigger>
116159
<Trigger Property="WindowStyle" Value="ToolWindow">
117160
<Setter TargetName="PART_MinAndMax" Property="Visibility" Value="Collapsed" />
118161
</Trigger>
119162
<MultiTrigger>
120163
<MultiTrigger.Conditions>
121-
<Condition Property="ResizeMode" Value="CanResizeWithGrip" />
122-
<Condition Property="WindowState" Value="Normal" />
164+
<Condition Property="ResizeMode" Value="CanResizeWithGrip" />
165+
<Condition Property="WindowState" Value="Normal" />
123166
</MultiTrigger.Conditions>
124167
<Setter TargetName="ResizeGrip" Property="Visibility" Value="Visible" />
125168
</MultiTrigger>
126-
<!--<MultiTrigger>
127-
<MultiTrigger.Conditions>
128-
<Condition Property="ResizeMode" Value="NoResize" />
129-
<Condition Property="WindowStyle" Value="ToolWindow" />
130-
</MultiTrigger.Conditions>
131-
<Setter TargetName="PART_MinAndMax" Property="Visibility" Value="Collapsed" />
132-
</MultiTrigger>-->
133169
</ControlTemplate.Triggers>
134170
</ControlTemplate>
135171
</Setter.Value>

0 commit comments

Comments
 (0)