Skip to content

Commit

Permalink
Fix VS2013 MenuItem styles
Browse files Browse the repository at this point in the history
Based on the recommendation by @BHandle here tgjones#291 (comment)

Avoids WPF generating traces like:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=HorizontalContentAlignment; DataItem=null; target element is 'MenuItemEx' (Name=''); target property is 'HorizontalContentAlignment' (type 'HorizontalAlignment')
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'MenuItemEx' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')

Note: VS2019 seems to have removed the UTF8 BOM header and the file is now strictly ANSI
  • Loading branch information
kornman00 committed Sep 13, 2020
1 parent 25bf9c1 commit 85baf7e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Gemini/Themes/VS2013/Controls/Menu.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
Originally from the Wide framework:
https://github.com/chandramouleswaran/Wide
Expand Down Expand Up @@ -362,9 +362,15 @@

<!--Set default styles-->
<Style TargetType="Separator" BasedOn="{StaticResource MetroSeparator}" />
<Style TargetType="MenuItem" BasedOn="{StaticResource MetroMenuItem}" />
<Style TargetType="MenuItem" BasedOn="{StaticResource MetroMenuItem}">
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style TargetType="Menu" BasedOn="{StaticResource StandardMenu}" />
<Style TargetType="ContextMenu" BasedOn="{StaticResource MetroContextMenu}" />
<Style TargetType="xcad:ContextMenuEx" BasedOn="{StaticResource MetroContextMenu}" />
<Style TargetType="xcad:MenuItemEx" BasedOn="{StaticResource MetroMenuItem}" />
</ResourceDictionary>
<Style TargetType="xcad:MenuItemEx" BasedOn="{StaticResource MetroMenuItem}">
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</ResourceDictionary>

0 comments on commit 85baf7e

Please sign in to comment.