Matt Cartlidge
asked on
WPF/XAML - Add a XAML geometric image to a menu item as an icon
I've had the question answered regarding how to display a XAML image in a button.
However, I need to do the same as an icon on a menu item. This doesn't cut it.
I want to leave behind icon/PNG images as much as possible and use XAML geometry so that my images can be scaled just as the other XAML controls can be.
Is it possible?
<Button Width="32" Height="32" MouseLeftButtonDown="Button_MouseLeftButtonDown" MouseDown="Button_MouseDown">
<Viewbox VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Fill">
<ContentPresenter ContentTemplate="{StaticResource icon-drag}"/>
</Viewbox>
</Button>
However, I need to do the same as an icon on a menu item. This doesn't cut it.
<Menu Grid.Column="0">
<MenuItem Header="_File">
<MenuItem Header="_New" Icon="{StaticResource icon-drag}"/>
</MenuItem>
</Menu>
I want to leave behind icon/PNG images as much as possible and use XAML geometry so that my images can be scaled just as the other XAML controls can be.
Is it possible?
ASKER
Is there a way to set styles globally?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks :)
Open in new window
And just food for thought, I'd highly recommend you start putting this in styles. Especially if you're going to be setting things like the alignment on every item, you can encompass all of that, including the path declerations into a style.