Skip to content

Commit 5c4471c

Browse files
committed
DynamicResource... freezing.. etc
1 parent 2c97fd4 commit 5c4471c

File tree

10 files changed

+75
-101
lines changed

10 files changed

+75
-101
lines changed

src/MahApps.Metro/MahApps.Metro/Styles/Colors.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107

108108
<SolidColorBrush x:Key="ThumbBrush" Color="{StaticResource Gray5}" options:Freeze="True" />
109109

110-
<LinearGradientBrush x:Key="ProgressBrush" StartPoint="1.002,0.5" EndPoint="0.001,0.5">
110+
<LinearGradientBrush x:Key="ProgressBrush" StartPoint="1.002,0.5" EndPoint="0.001,0.5" options:Freeze="True">
111111
<GradientStop Offset="0" Color="{StaticResource HighlightColor}" />
112112
<GradientStop Offset="1" Color="{StaticResource AccentColor3}" />
113113
</LinearGradientBrush>

src/MahApps.Metro/MahApps.Metro/Styles/Controls.Calendar.xaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@
169169
</DataTemplate>
170170
</ControlTemplate.Resources>
171171
<Grid x:Name="PART_Root">
172-
<Grid.Resources>
173-
<SolidColorBrush x:Key="DisabledColor" Color="#A5FFFFFF" />
174-
</Grid.Resources>
175-
176172
<Border Background="{TemplateBinding Background}"
177173
BorderBrush="{TemplateBinding BorderBrush}"
178174
BorderThickness="{TemplateBinding BorderThickness}"
@@ -378,10 +374,10 @@
378374
</Grid>
379375
</Border>
380376
<Rectangle x:Name="PART_DisabledVisual"
381-
Fill="{StaticResource DisabledColor}"
377+
Fill="{DynamicResource ControlsDisabledBrush}"
382378
Opacity="0"
383379
Stretch="Fill"
384-
Stroke="{StaticResource DisabledColor}"
380+
Stroke="{DynamicResource ControlsDisabledBrush}"
385381
StrokeThickness="1"
386382
Visibility="Collapsed" />
387383
<VisualStateManager.VisualStateGroups>

src/MahApps.Metro/MahApps.Metro/Styles/Controls.TabControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
</Style>
9999

100100
<Style x:Key="MetroTabItem" TargetType="TabItem">
101-
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabControl}}, Path=Background, Mode=OneWay}" />
101+
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabControl}}, Path=Background, Mode=OneWay, FallbackValue=Transparent}" />
102102
<Setter Property="BorderBrush" Value="{DynamicResource AccentColorBrush}" />
103103
<Setter Property="BorderThickness" Value="0" />
104104
<!-- special property for header font size -->

src/MahApps.Metro/MahApps.Metro/Styles/VS/Button.xaml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
22

3-
<ResourceDictionary.MergedDictionaries>
4-
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
5-
</ResourceDictionary.MergedDictionaries>
6-
73
<Style x:Key="StandardButton" TargetType="Button">
8-
<Setter Property="Background" Value="{StaticResource BackgroundNormal}" />
9-
<Setter Property="BorderBrush" Value="{StaticResource BorderBrushNormal}" />
10-
<Setter Property="Foreground" Value="{StaticResource Foreground}" />
4+
<Setter Property="Background" Value="{DynamicResource BackgroundNormal}" />
5+
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrushNormal}" />
6+
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
117
<Setter Property="Template">
128
<Setter.Value>
139
<ControlTemplate TargetType="Button">
@@ -21,12 +17,12 @@
2117
</Border>
2218
<ControlTemplate.Triggers>
2319
<Trigger Property="IsMouseOver" Value="True">
24-
<Setter Property="Background" Value="{StaticResource BackgroundHighlighted}" />
25-
<Setter Property="BorderBrush" Value="{StaticResource BorderBrushHighlighted}" />
20+
<Setter Property="Background" Value="{DynamicResource BackgroundHighlighted}" />
21+
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrushHighlighted}" />
2622
</Trigger>
2723
<Trigger Property="IsPressed" Value="True">
28-
<Setter Property="Background" Value="{StaticResource BackgroundSelected}" />
29-
<Setter Property="BorderBrush" Value="{StaticResource BorderBrushSelected}" />
24+
<Setter Property="Background" Value="{DynamicResource BackgroundSelected}" />
25+
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrushSelected}" />
3026
</Trigger>
3127
<Trigger Property="IsEnabled" Value="False">
3228
<Setter Property="Background" Value="Transparent" />
@@ -39,7 +35,7 @@
3935

4036
<Style x:Key="LinkButton" TargetType="Button">
4137
<Setter Property="Cursor" Value="Hand" />
42-
<Setter Property="Foreground" Value="{StaticResource LinkButtonForeground}" />
38+
<Setter Property="Foreground" Value="{DynamicResource LinkButtonForeground}" />
4339
<Setter Property="Template">
4440
<Setter.Value>
4541
<ControlTemplate TargetType="Button">
@@ -51,7 +47,7 @@
5147
</Setter>
5248
<Style.Triggers>
5349
<Trigger Property="IsMouseOver" Value="true">
54-
<Setter Property="Foreground" Value="{StaticResource LinkButtonForegroundHighlighted}" />
50+
<Setter Property="Foreground" Value="{DynamicResource LinkButtonForegroundHighlighted}" />
5551
</Trigger>
5652
</Style.Triggers>
5753
</Style>

src/MahApps.Metro/MahApps.Metro/Styles/VS/Colors.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
mc:Ignorable="options">
66

77
<!-- Background -->
8-
<SolidColorBrush x:Key="Background" Color="#1C1C1C" />
9-
<SolidColorBrush x:Key="LightBackground" Color="#2D2D30" />
8+
<SolidColorBrush x:Key="Background" Color="#1C1C1C" options:Freeze="True" />
9+
<SolidColorBrush x:Key="LightBackground" Color="#2D2D30" options:Freeze="True" />
10+
1011
<Color x:Key="AccentColor">#2D2D30</Color>
1112
<Color x:Key="BlackColor">#FFFFFFFF</Color>
1213
<Color x:Key="WhiteColor">#2D2D30</Color>

src/MahApps.Metro/MahApps.Metro/Styles/VS/ListBox.xaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
22

3-
<ResourceDictionary.MergedDictionaries>
4-
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
5-
</ResourceDictionary.MergedDictionaries>
6-
73
<Style x:Key="StandardListBox" TargetType="{x:Type ListBox}">
84
<Setter Property="Background" Value="Transparent" />
95
<Setter Property="BorderThickness" Value="0" />
106
<Style.Resources>
117
<Style TargetType="{x:Type ListBoxItem}">
12-
<Setter Property="Background" Value="{StaticResource BackgroundNormal}" />
8+
<Setter Property="Background" Value="{DynamicResource BackgroundNormal}" />
139
<Setter Property="BorderBrush" Value="Transparent" />
1410
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
1511
<Setter Property="Template">
@@ -28,12 +24,12 @@
2824
<Condition Property="IsMouseOver" Value="True" />
2925
<Condition Property="IsSelected" Value="False" />
3026
</MultiTrigger.Conditions>
31-
<Setter Property="Background" Value="{StaticResource BackgroundHighlighted}" />
32-
<Setter Property="BorderBrush" Value="{StaticResource BorderBrushHighlighted}" />
27+
<Setter Property="Background" Value="{DynamicResource BackgroundHighlighted}" />
28+
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrushHighlighted}" />
3329
</MultiTrigger>
3430
<Trigger Property="IsSelected" Value="True">
35-
<Setter Property="Background" Value="{StaticResource BackgroundSelected}" />
36-
<Setter Property="BorderBrush" Value="{StaticResource BorderBrushSelected}" />
31+
<Setter Property="Background" Value="{DynamicResource BackgroundSelected}" />
32+
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrushSelected}" />
3733
</Trigger>
3834
</ControlTemplate.Triggers>
3935
</ControlTemplate>

src/MahApps.Metro/MahApps.Metro/Styles/VS/Menu.xaml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
22

3-
<ResourceDictionary.MergedDictionaries>
4-
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
5-
</ResourceDictionary.MergedDictionaries>
6-
73
<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="Separator">
84
<Setter Property="Height" Value="1" />
95
<Setter Property="Template">
106
<Setter.Value>
117
<ControlTemplate TargetType="Separator">
128
<Border Margin="25 0 0 0"
13-
BorderBrush="{StaticResource MenuSeparatorBorderBrush}"
9+
BorderBrush="{DynamicResource MenuSeparatorBorderBrush}"
1410
BorderThickness="1" />
1511
</ControlTemplate>
1612
</Setter.Value>
1713
</Setter>
1814
</Style>
1915

2016
<Style x:Key="StandardMenu" TargetType="{x:Type Menu}">
21-
<Setter Property="Background" Value="{StaticResource LightBackground}" />
22-
<Setter Property="Foreground" Value="{StaticResource Foreground}" />
17+
<Setter Property="Background" Value="{DynamicResource LightBackground}" />
18+
<Setter Property="Foreground" Value="{DynamicResource Foreground}" />
2319
</Style>
2420

2521
<Style x:Key="StandardMenuItem" TargetType="{x:Type MenuItem}">
@@ -78,8 +74,8 @@
7874
<Grid Margin="0 0 5 5">
7975
<!-- Border 2 -->
8076
<Border x:Name="SubMenuBorder"
81-
Background="{StaticResource SubmenuItemBackground}"
82-
BorderBrush="{StaticResource MenuSeparatorBorderBrush}"
77+
Background="{DynamicResource SubmenuItemBackground}"
78+
BorderBrush="{DynamicResource MenuSeparatorBorderBrush}"
8379
BorderThickness="1"
8480
SnapsToDevicePixels="True">
8581
<Grid x:Name="SubMenu"
@@ -98,8 +94,8 @@
9894
Margin="1 0 0 0"
9995
HorizontalAlignment="Left"
10096
VerticalAlignment="Top"
101-
Background="{StaticResource SubmenuItemBackground}"
102-
BorderBrush="{StaticResource SubmenuItemBackground}"
97+
Background="{DynamicResource SubmenuItemBackground}"
98+
BorderBrush="{DynamicResource SubmenuItemBackground}"
10399
BorderThickness="1"
104100
SnapsToDevicePixels="False" />
105101
</Grid>
@@ -130,55 +126,55 @@
130126
<Trigger Property="Role" Value="SubmenuHeader">
131127
<Setter Property="DockPanel.Dock" Value="Top" />
132128
<Setter Property="Padding" Value="10 3 0 3" />
133-
<Setter TargetName="Border" Property="Background" Value="{StaticResource SubmenuItemBackground}" />
129+
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SubmenuItemBackground}" />
134130
<Setter TargetName="Border" Property="MinHeight" Value="22" />
135131
</Trigger>
136132
<Trigger Property="Role" Value="SubmenuItem">
137133
<Setter Property="DockPanel.Dock" Value="Top" />
138134
<Setter Property="Padding" Value="10 3 0 3" />
139135
<Setter TargetName="ArrowPanel" Property="Visibility" Value="Collapsed" />
140-
<Setter TargetName="Border" Property="Background" Value="{StaticResource SubmenuItemBackground}" />
136+
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SubmenuItemBackground}" />
141137
<Setter TargetName="Border" Property="MinHeight" Value="22" />
142138
</Trigger>
143139
<MultiTrigger>
144140
<MultiTrigger.Conditions>
145141
<Condition Property="IsHighlighted" Value="true" />
146142
<Condition Property="Role" Value="TopLevelHeader" />
147143
</MultiTrigger.Conditions>
148-
<Setter TargetName="Border" Property="Background" Value="{StaticResource MenuItemHighlightedBackground}" />
144+
<Setter TargetName="Border" Property="Background" Value="{DynamicResource MenuItemHighlightedBackground}" />
149145
</MultiTrigger>
150146
<MultiTrigger>
151147
<MultiTrigger.Conditions>
152148
<Condition Property="IsHighlighted" Value="true" />
153149
<Condition Property="Role" Value="TopLevelItem" />
154150
</MultiTrigger.Conditions>
155-
<Setter TargetName="Border" Property="Background" Value="{StaticResource MenuItemHighlightedBackground}" />
151+
<Setter TargetName="Border" Property="Background" Value="{DynamicResource MenuItemHighlightedBackground}" />
156152
</MultiTrigger>
157153
<MultiTrigger>
158154
<MultiTrigger.Conditions>
159155
<Condition Property="IsHighlighted" Value="true" />
160156
<Condition Property="Role" Value="SubmenuHeader" />
161157
</MultiTrigger.Conditions>
162-
<Setter TargetName="Border" Property="Background" Value="{StaticResource SubmenuItemBackgroundHighlighted}" />
158+
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SubmenuItemBackgroundHighlighted}" />
163159
</MultiTrigger>
164160
<MultiTrigger>
165161
<MultiTrigger.Conditions>
166162
<Condition Property="IsHighlighted" Value="true" />
167163
<Condition Property="Role" Value="SubmenuItem" />
168164
</MultiTrigger.Conditions>
169-
<Setter TargetName="Border" Property="Background" Value="{StaticResource SubmenuItemBackgroundHighlighted}" />
165+
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SubmenuItemBackgroundHighlighted}" />
170166
</MultiTrigger>
171167
<MultiTrigger>
172168
<MultiTrigger.Conditions>
173169
<Condition Property="IsSubmenuOpen" Value="true" />
174170
<Condition Property="Role" Value="TopLevelHeader" />
175171
</MultiTrigger.Conditions>
176-
<Setter TargetName="Border" Property="Background" Value="{StaticResource SubmenuItemBackground}" />
177-
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource MenuSeparatorBorderBrush}" />
172+
<Setter TargetName="Border" Property="Background" Value="{DynamicResource SubmenuItemBackground}" />
173+
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MenuSeparatorBorderBrush}" />
178174
<Setter TargetName="Border" Property="BorderThickness" Value="1 1 1 0" />
179175
</MultiTrigger>
180176
<Trigger Property="IsSubmenuOpen" Value="true">
181-
<Setter TargetName="ArrowPanelPath" Property="Fill" Value="{StaticResource BackgroundSelected}" />
177+
<Setter TargetName="ArrowPanelPath" Property="Fill" Value="{DynamicResource BackgroundSelected}" />
182178
</Trigger>
183179
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
184180
<Setter TargetName="SubMenuPopup" Property="PopupAnimation" Value="None" />
@@ -187,7 +183,7 @@
187183
<Setter TargetName="Icon" Property="Visibility" Value="Collapsed" />
188184
</Trigger>
189185
<Trigger Property="IsEnabled" Value="False">
190-
<Setter Property="Foreground" Value="{StaticResource MenuDisabledForeground}" />
186+
<Setter Property="Foreground" Value="{DynamicResource MenuDisabledForeground}" />
191187
</Trigger>
192188
</ControlTemplate.Triggers>
193189
</ControlTemplate>

0 commit comments

Comments
 (0)