How can I use SVG files as icons in the ribbon as opposed to PNG files? Is this directly possible at all or do I need to go through a conversion step and create a PNG bitmap and use this bitmap?
How can I use SVG files as icons in the ribbon as opposed to PNG files? Is this directly possible at all or do I need to go through a conversion step and create a PNG bitmap and use this bitmap?
Hi Peter,
WPF doesn't currently have built-in support for SVG images. That being said, we've found that this SvgToXaml utility is really handy since it will convert a SVG file to a vector DrawingImage that can be used as a WPF ImageSource. We recommend using vector images like DrawingImages instead of raster PNG images when possible.
Would you have a sample for me, that shows how I can code this in the Actipro Ribbon?
Hi Peter,
You just run the linked (above) SvgToXaml app and pick a .svg file. It converts that to a DrawingImage. DrawingImage is an ImageSource like BitmapImage, so you can use it anywhere an ImageSource is, like for ribbon button image properties.
Since DrawingImages can get large XAML-wise, it's probably best to put your DrawingImages as x:Key'ed resources in Application.Resources and then use StaticResource to reference them on ImageSource properties that should use them.
Thank you very much, very helpful.
Please log in to a validated account to post comments.