Closed GF-Huang closed 5 years ago
@GreatFireWall Please, post more informations when you open an issue! https://github.com/MahApps/MahApps.Metro/blob/develop/.github/ISSUE_TEMPLATE/bug_report.md
@punker76 sorry, it may not be a bug ? just the left side edge too less, seems like no edges between Icon and menu item left edge.
@GreatFireWall How do you set these icons? Can you post your Xaml code of this ContextMenu?
@punker76
@GreatFireWall Thx! I see you use the IconPacks extension to set the icon. This is ok, but it doesn't set the horizontal alignement for the inner icon itself. Because the menu style uses the streched enum value for the horizontal alignement. I suggest to use the normal class and not the extension from the IconPacks where you can set the horizontal alignement.
<MenuItem Header="Icon Test">
<MenuItem Header="Test 1" Icon="{iconPacks:Modern Kind=Connect}" />
<MenuItem Header="Test 1">
<MenuItem.Icon>
<iconPacks:PackIconModern Kind="Connect" HorizontalAlignment="Center" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
@punker76 Well, Solved ! Thank You !
@punker76 By the way, Can I use style for {iconPacks:Modern xxx} to make it effect all instance while in a ContextMenu, because I want to keep my code as short as possible.
@GreatFireWall Yes, you can define a global style at the App.xaml or at the main window where you use the IconPacks.
<Style TargetType="{x:Type iconPacks:PackIconModern}" BasedOn="{StaticResource {x:Type iconPacks:PackIconModern}}">
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
@punker76 ok, thanks your guide !