Skip to content

Commit ffc7511

Browse files
committed
Replace all dynamic references to static to just static and rearrange style to avoid raising errors due to defining it later in the XAML.
1 parent d34b879 commit ffc7511

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

Rubberduck.Core/UI/Controls/ToolBar.xaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
3131
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
3232
<Setter Property="Background" Value="Transparent"/>
33-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
33+
<Setter Property="Foreground" Value="{StaticResource SystemColors.MenuTextBrushKey}"/>
3434
<Setter Property="BorderThickness" Value="1"/>
3535
<Setter Property="Margin" Value="0,1,0,0"/>
3636
<Setter Property="Padding" Value="8,3"/>
@@ -70,7 +70,7 @@
7070
<Setter Property="Background" TargetName="GlyphPanel" Value="{StaticResource GlyphPanelHighlightBackgroundBrush}"/>
7171
</Trigger>
7272
<Trigger Property="IsEnabled" Value="False">
73-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
73+
<Setter Property="Foreground" Value="{StaticResource SystemColors.GrayTextBrushKey}"/>
7474
</Trigger>
7575
</ControlTemplate.Triggers>
7676
</ControlTemplate>
@@ -88,7 +88,7 @@
8888
<ContentPresenter x:Name="Icon" Content="{TemplateBinding Icon}" ContentSource="Icon" Margin="4,0,6,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
8989
<Path x:Name="GlyphPanel" Data="M0,2.5L2.5,5 7,0.5" FlowDirection="LeftToRight" Margin="4,0,6,0" Stroke="{TemplateBinding Foreground}" StrokeThickness="1.2" Visibility="Collapsed" VerticalAlignment="Center"/>
9090
<ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
91-
<Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" HorizontalOffset="-1" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Placement="Bottom">
91+
<Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" HorizontalOffset="-1" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{StaticResource SystemParameters.MenuPopupAnimationKey}" Placement="Bottom">
9292
<themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
9393
<Border x:Name="SubMenuBorder" BorderBrush="{StaticResource ToolBarMenuBorderBrush}" BorderThickness="1" Background="{StaticResource ToolBarSubMenuBackgroundBrush}">
9494
<Grid>
@@ -137,7 +137,7 @@
137137
<Setter Property="Color" TargetName="Shdw" Value="{StaticResource DropShadowColor}"/>
138138
</Trigger>
139139
<Trigger Property="IsEnabled" Value="False">
140-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
140+
<Setter Property="Foreground" Value="{StaticResource SystemColors.GrayTextBrushKey}"/>
141141
</Trigger>
142142
<Trigger Property="CanContentScroll" SourceName="SubMenuScrollViewer" Value="False">
143143
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}"/>
@@ -174,7 +174,7 @@
174174
<Setter Property="Background" TargetName="Border" Value="{StaticResource HighlightBackgroundBrush}"/>
175175
</Trigger>
176176
<Trigger Property="IsEnabled" Value="False">
177-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
177+
<Setter Property="Foreground" Value="{StaticResource SystemColors.GrayTextBrushKey}"/>
178178
</Trigger>
179179
</ControlTemplate.Triggers>
180180
</ControlTemplate>
@@ -202,7 +202,7 @@
202202
</Border>
203203
<ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
204204
<Path Grid.Column="3" DockPanel.Dock="Right" Data="M0,0L4,3.5 0,7z" Fill="{TemplateBinding Foreground}" Margin="4,0,6,0" VerticalAlignment="Center"/>
205-
<Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" Placement="Right">
205+
<Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{StaticResource SystemParameters.MenuPopupAnimationKey}" Placement="Right">
206206
<themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
207207
<Border x:Name="SubMenuBorder" BorderBrush="{StaticResource ToolBarMenuBorderBrush}" BorderThickness="1" Background="{StaticResource ToolBarSubMenuBackgroundBrush}" Grid.IsSharedSizeScope="True">
208208
<ScrollViewer x:Name="SubMenuScrollViewer" Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}">
@@ -245,7 +245,7 @@
245245
<Setter Property="Color" TargetName="Shdw" Value="{StaticResource DropShadowColor}"/>
246246
</Trigger>
247247
<Trigger Property="IsEnabled" Value="False">
248-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
248+
<Setter Property="Foreground" Value="{StaticResource SystemColors.GrayTextBrushKey}"/>
249249
</Trigger>
250250
<Trigger Property="CanContentScroll" SourceName="SubMenuScrollViewer" Value="False">
251251
<Setter Property="Canvas.Top" TargetName="OpaqueRect" Value="{Binding VerticalOffset, ElementName=SubMenuScrollViewer}"/>
@@ -289,7 +289,7 @@
289289
</Setter>
290290
<Style.Triggers>
291291
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
292-
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
292+
<Setter Property="Background" Value="{StaticResource SystemColors.ControlBrushKey}"/>
293293
</DataTrigger>
294294
</Style.Triggers>
295295
</Style>
@@ -324,7 +324,7 @@
324324
</Setter>
325325
<Style.Triggers>
326326
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
327-
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
327+
<Setter Property="Background" Value="{StaticResource SystemColors.ControlBrushKey}"/>
328328
</DataTrigger>
329329
</Style.Triggers>
330330
</Style>
@@ -372,7 +372,7 @@
372372
<Grid x:Name="Grid" Margin="3,1,1,1" SnapsToDevicePixels="true">
373373
<Grid x:Name="OverflowGrid" HorizontalAlignment="Right">
374374
<ToggleButton x:Name="OverflowButton" ClickMode="Press" FocusVisualStyle="{x:Null}" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{TemplateBinding HasOverflowItems}" Style="{StaticResource ToolBarHorizontalOverflowButtonStyle}" Visibility="{Binding ElementName=OverflowButton, Path=IsEnabled, Converter={StaticResource BoolToVisibility}}"/>
375-
<Popup x:Name="OverflowPopup" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" StaysOpen="false">
375+
<Popup x:Name="OverflowPopup" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{StaticResource SystemParameters.ComboBoxPopupAnimationKey}" Placement="Bottom" StaysOpen="false">
376376
<themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
377377
<Border x:Name="ToolBarSubMenuBorder" BorderBrush="{StaticResource ToolBarMenuBorderBrush}" BorderThickness="1" Background="{StaticResource ToolBarSubMenuBackgroundBrush}" RenderOptions.ClearTypeHint="Enabled">
378378
<ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Cycle" FocusVisualStyle="{x:Null}" Focusable="true" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200"/>
@@ -421,15 +421,15 @@
421421
<Setter Property="Background" Value="{StaticResource ToolBarVerticalBackgroundBrush}"/>
422422
</Trigger>
423423
<Trigger Property="IsEnabled" Value="false">
424-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
424+
<Setter Property="Foreground" Value="{StaticResource SystemColors.GrayTextBrushKey}"/>
425425
</Trigger>
426426
</ControlTemplate.Triggers>
427427
</ControlTemplate>
428428
</Setter.Value>
429429
</Setter>
430430
<Style.Triggers>
431431
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true">
432-
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
432+
<Setter Property="Background" Value="{StaticResource SystemColors.ControlBrushKey}"/>
433433
</DataTrigger>
434434
</Style.Triggers>
435435
</Style>

Rubberduck.Core/UI/Styles/DefaultStyle.xaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,19 +150,29 @@
150150
<Condition Property="Selector.IsSelectionActive" Value="True" />
151151
</MultiTrigger.Conditions>
152152
<Setter Property="BorderBrush" Value="{StaticResource HighlightBorderActiveBrush}"/>
153-
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
153+
<Setter Property="Background" Value="{StaticResource SystemColors.HighlightBrushKey}" />
154154
</MultiTrigger>
155155
<MultiTrigger>
156156
<MultiTrigger.Conditions>
157157
<Condition Property="IsSelected" Value="True" />
158158
<Condition Property="Selector.IsSelectionActive" Value="False" />
159159
</MultiTrigger.Conditions>
160160
<Setter Property="BorderBrush" Value="{StaticResource HighlightInactiveBorderBrush}"/>
161-
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
161+
<Setter Property="Background" Value="{StaticResource SystemColors.InactiveSelectionHighlightBrushKey}" />
162162
</MultiTrigger>
163163
</Style.Triggers>
164164
</Style>
165165

166+
<Style x:Key="FocusVisual">
167+
<Setter Property="Control.Template">
168+
<Setter.Value>
169+
<ControlTemplate>
170+
<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{StaticResource SystemColors.ControlTextBrushKey}" StrokeThickness="1" StrokeDashArray="1 2"/>
171+
</ControlTemplate>
172+
</Setter.Value>
173+
</Setter>
174+
</Style>
175+
166176
<Style x:Key="PrettyListBoxItem" TargetType="{x:Type ListBoxItem}">
167177
<Style.Resources>
168178
<Style TargetType="{x:Type Border}">
@@ -211,24 +221,14 @@
211221
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource HighlightBorderActiveBrush}"/>
212222
</MultiTrigger>
213223
<Trigger Property="IsEnabled" Value="False">
214-
<Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
224+
<Setter Property="TextElement.Foreground" TargetName="Bd" Value="{StaticResource SystemColors.GrayTextBrushKey}"/>
215225
</Trigger>
216226
</ControlTemplate.Triggers>
217227
</ControlTemplate>
218228
</Setter.Value>
219229
</Setter>
220230
</Style>
221231

222-
<Style x:Key="FocusVisual">
223-
<Setter Property="Control.Template">
224-
<Setter.Value>
225-
<ControlTemplate>
226-
<Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
227-
</ControlTemplate>
228-
</Setter.Value>
229-
</Setter>
230-
</Style>
231-
232232
<Style TargetType="ScrollViewer">
233233
<Style.Setters>
234234
<Setter Property="settings:ScrollViewerCorrector.FixScrolling" Value="True" />

0 commit comments

Comments
 (0)