Skip to content

Instantly share code, notes, and snippets.

@jammerxd
Created December 1, 2015 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jammerxd/68a4884dc4ed206bd9cc to your computer and use it in GitHub Desktop.
Save jammerxd/68a4884dc4ed206bd9cc to your computer and use it in GitHub Desktop.
<mahapps:MetroWindow.Resources>
<Ellipse x:Key="AppThemeMenuIcon"
x:Shared="False"
Width="16"
Height="16"
StrokeThickness="1"
Stroke="{Binding BorderColorBrush, Mode=OneWay}"
Fill="{Binding ColorBrush, Mode=OneWay}" />
<Ellipse x:Key="AccentMenuIcon"
x:Shared="False"
Width="16"
Height="16"
Fill="{Binding ColorBrush, Mode=OneWay}" />
<Style x:Key="AppThemeMenuItemStyle"
TargetType="{x:Type MenuItem}"
BasedOn="{StaticResource MetroMenuItem}">
<Setter Property="Icon"
Value="{StaticResource AppThemeMenuIcon}" />
<Setter Property="Header"
Value="{Binding displayName, Mode=OneWay}" />
<Setter Property="CommandParameter" Value="{Binding Name}"/>
<Setter Property="Command" Value="{Binding ChangeThemeCommand}"/>
</Style>
<Style x:Key="AccentColorMenuItemStyle"
TargetType="{x:Type MenuItem}"
BasedOn="{StaticResource MetroMenuItem}">
<Setter Property="Icon"
Value="{StaticResource AccentMenuIcon}" />
<Setter Property="Header"
Value="{Binding displayName, Mode=OneWay}" />
<Setter Property="CommandParameter" Value="{Binding Name}"/>
<Setter Property="Command" Value="{Binding ChangeAccentCommand}"/>
</Style>
</mahapps:MetroWindow.Resources>
<mahapps:MetroWindow.RightWindowCommands>
<mahapps:WindowCommands>
<Button ToolTip="Visual Settings" Helpers:ContextMenuLeftClickBehavior.IsLeftClickEnabled="True">
<Rectangle
Width="22"
Height="22"
Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}">
<Rectangle.OpacityMask>
<VisualBrush
Stretch="Uniform"
Visual="{StaticResource appbar_settings}">
</VisualBrush>
</Rectangle.OpacityMask>
</Rectangle>
<Button.ContextMenu >
<ContextMenu>
<MenuItem Header="Theme" ItemsSource="{Binding AppThemes, Mode=OneWay}" ItemContainerStyle="{StaticResource AppThemeMenuItemStyle}" />
<MenuItem Header="Accent" ItemsSource="{Binding AccentColors, Mode=OneWay}" ItemContainerStyle="{StaticResource AccentColorMenuItemStyle}"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
</mahapps:WindowCommands>
</mahapps:MetroWindow.RightWindowCommands>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment