tags:

views:

68

answers:

1

I have some icon resources as DrawingImages that is made up of many GeometryDrawings. I have File Menu items and toolbar buttons that use these images via resource bindings to MenuItem.Icon. Unfortunately, only one of the MenuItems show the icon.

I am sure you can't assign a single DrawingImage resource to many MenuItem.Icon (or anything else for that matter), but I don't know of an alternative. I would prefer not to duplicate the DrawingImage resource, but if I have too I guess I will.

+1  A: 

You assign an Image control to the Icon Property and set the DrawingImage into the Image.Source property.

In XAML:

<MenuItem>
    <MenuItem.Icon>
        <Image Source="{StaticResource myDrawingImage}"/>
    </MenuItem.Icon>
    <!-- everyhting else -->
</MenuItem>

In C#:

menuItem.Icon = new Image() {Source = (ImageSource)Resources["myDrawingImage"]};
Nir
Turns out the problem was a mistake in using Image as the Resource element versus the DrawingImage.I didn't see the forest through the trees
Ryan Cromwell