|
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}"> |
10 | 9 | <Setter Property="Foreground" Value="{DynamicResource WD.WindowForegroundColorBrush}" /> |
11 | | - <Setter Property="Background" Value="{DynamicResource WD.BackgroundSolidColorBrush}" /> |
| 10 | + <Setter Property="Background" Value="{DynamicResource WD.BackgroundSolidColorBrush}" /> |
12 | 11 | <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" /> |
16 | 15 | <Setter Property="UseLayoutRounding" Value="True" /> |
17 | 16 | <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}" /> |
20 | 19 | <Setter Property="FontFamily" Value="{DynamicResource WD.NormalFontFamily}" /> |
21 | 20 | <Setter Property="shell:WindowChrome.WindowChrome"> |
22 | 21 | <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" /> |
25 | 23 | </Setter.Value> |
26 | 24 | </Setter> |
27 | 25 | <Setter Property="Template"> |
28 | 26 | <Setter.Value> |
29 | 27 | <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}"> |
35 | 33 | <Grid.RowDefinitions> |
36 | 34 | <RowDefinition Height="Auto" /> |
37 | 35 | <RowDefinition Height="*" /> |
38 | 36 | </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}"> |
41 | 41 | <Grid.ColumnDefinitions> |
42 | 42 | <ColumnDefinition Width="Auto" /> |
43 | 43 | <ColumnDefinition Width="*" /> |
44 | | - <ColumnDefinition Width="Auto" MinWidth="30"/> |
| 44 | + <ColumnDefinition Width="Auto" MinWidth="30" /> |
45 | 45 | </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" |
48 | 52 | 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"> |
55 | 69 | <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}"> |
59 | 76 | <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}" /> |
62 | 84 | </Grid> |
63 | 85 | </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}"> |
67 | 92 | <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" /> |
72 | 102 | </Grid> |
73 | 103 | </Button> |
74 | | - <Button Name="PART_RestoreButton" IsTabStop="False" Padding="0" |
75 | | - Style="{DynamicResource WD.WindowButtonStyle}" |
| 104 | + <Button |
| 105 | + Name="PART_RestoreButton" |
| 106 | + Padding="0" |
76 | 107 | Command="{Binding Source={x:Static shell:SystemCommands.RestoreWindowCommand}}" |
| 108 | + IsTabStop="False" |
| 109 | + Style="{DynamicResource WD.WindowButtonStyle}" |
77 | 110 | Visibility="Collapsed"> |
78 | 111 | <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" /> |
83 | 121 | </Grid> |
84 | 122 | </Button> |
85 | 123 | </WrapPanel> |
86 | 124 |
|
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" /> |
96 | 138 | </Button> |
97 | 139 | </WrapPanel> |
98 | 140 | </Grid> |
99 | 141 | <AdornerDecorator Grid.Row="1" KeyboardNavigation.IsTabStop="False"> |
100 | | - <ContentPresenter x:Name="MainContentPresenter" ClipToBounds="True"/> |
| 142 | + <ContentPresenter x:Name="MainContentPresenter" ClipToBounds="True" /> |
101 | 143 | </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" /> |
107 | 151 | </Grid> |
108 | 152 | </Border> |
109 | 153 | <ControlTemplate.Triggers> |
110 | 154 | <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" /> |
115 | 158 | </Trigger> |
116 | 159 | <Trigger Property="WindowStyle" Value="ToolWindow"> |
117 | 160 | <Setter TargetName="PART_MinAndMax" Property="Visibility" Value="Collapsed" /> |
118 | 161 | </Trigger> |
119 | 162 | <MultiTrigger> |
120 | 163 | <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" /> |
123 | 166 | </MultiTrigger.Conditions> |
124 | 167 | <Setter TargetName="ResizeGrip" Property="Visibility" Value="Visible" /> |
125 | 168 | </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>--> |
133 | 169 | </ControlTemplate.Triggers> |
134 | 170 | </ControlTemplate> |
135 | 171 | </Setter.Value> |
|
0 commit comments