Is it possible (what property) to use a Xaml resource as the Icon/Image for a ButtonTool in the Ribbon?
I have a handful of Icons created from a designer that are Xaml resources and I'd like to know if I can use those somehow or if i'll need to create Png/JPG versions.
<DrawingImage x:Key='GeometryTest'>
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="AliceBlue">
<GeometryDrawing.Pen>
<Pen Brush="#FF666666" Thickness="1" StartLineCap="Flat" EndLineCap="Flat" DashCap="Flat" LineJoin="Miter" MiterLimit="4"/>
</GeometryDrawing.Pen>
<GeometryDrawing.Geometry>
<GeometryGroup>
<PathGeometry>
<PathGeometry.Figures>M6.18181800842285,6L60,6L60,55.2727279663086L6.18181800842285,55.2727279663086z</PathGeometry.Figures>
</PathGeometry>
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
<GeometryDrawing>
<Pen Brush="#FF666666" Thickness="4" StartLineCap="Flat" EndLineCap="Flat" DashCap="Flat" LineJoin="Miter" MiterLimit="4"/>
<PathGeometry.Figures>M13.6363639831543,19.6363639831543L21.0909099578857,19.6363639831543L21.0909099578857,53.4545440673828L13.6363639831543,53.4545440673828z
</PathGeometry.Figures>
<PathGeometry.Figures>M29.0909099578857,13.0909090042114L37.2727279663086,13.0909090042114L37.2727279663086,53.0909080505371L29.0909099578857,53.0909080505371z
<PathGeometry.Figures>M45,24L52.9090919494629,24L52.9090919494629,53.6363639831543L45,53.6363639831543z
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
Hi,
Were you able to resolve this problem? I am trying to do something exactly as to what you are planning?
Thanks,
Anu
The image properties (i.e. SmallImage/LargeImage) of the tools are of type ImageSource so you can use any WPF ImageSource derived class. Normally you would use a BitmapImage if you have a raster image file such as a png or a DrawingImage if you have some drawing such as when you have a path. I'm guessing that you have some paths so maybe you should look into the latter - i.e. creating a DrawingImage whose Drawing is a GeometryDrawing whose Geometry is a PathGeometry.