Hello,
Is it possible to have a xaml vector image as large or small image in the XamRibbon of office 2010?Or should it always be an image file (extension .png, ...)?
Can someone give me an example of this, as the direct way of doing this isn't working.
Thanks in advance.
Kind regards,Dries
Hi Dries,
The XamRibbon is using regular .NET bitmap image objects so the process for loading a vector image would be the same as it would be for loading it into an Image control. The first thing you need to do is convert the vector image into XAML code. This XAML code needs to be a DrawingImage so that you can use it directly as the source for the LargeImage/SmallImage ribbon properties.
Microsoft has a tool called Microsoft Expression Design 4 that you can use to convert vector graphics into a XAML ResourceDictionary. There are some directions about this here:http://stackoverflow.com/questions/28398446/how-do-i-create-vector-images-for-wpf
If it exports your image as a DrawingBrush, just change it to a DrawingImage instead. you should be able to use the image like so: LargeImage="{StaticResource MyLargeImage}" where MyLargeImage is the x:Key for your exported DrawingImage.
To add to what I said above, you should be aware of what happens to the image when you disable a ribbon tool. For normal raster images the ribbon tool will create a gray scale of your image and use that when the control is disabled. However, as you might expect, it can't do this for a vector image so in this case all it will do is set the opacity to around 50%.
Hello Rob,
Thanks for your answers! It worked now through the DrawingImage! Opacity on 50% was indeed what we saw now, but that's ok. Thank you!
KR,Dries