Reputation: 3904
Working with the MahApps.Metro package and would like to handle the click event of the windows Icon so that I can show the user a Flyout with a application menu, does anyone know how this could be achieved, I cannot see any obvious events on the MetroWindow object to support this?
Upvotes: 0
Views: 866
Reputation: 9827
Create a new Template for the Icon and set it as IconTemplate="{DynamicResource DataTemplate1}"
in MetroWindow
.
<Controls:MetroWindow.Resources>
<DataTemplate x:Key="DataTemplate1">
<Button Click="Button_Click">
<Button.Template>
<ControlTemplate TargetType="Button">
<Image Source="Icon.ico" />
</ControlTemplate>
</Button.Template>
<Button.ContextMenu>
<ContextMenu>
<Menu>
<MenuItem Header="Nonsense"/>
</Menu>
</ContextMenu>
</Button.ContextMenu>
</Button>
</DataTemplate>
</Controls:MetroWindow.Resources>
Handle the Click
event of the Button
.
Upvotes: 3