Posted 29 November 2017, 5:11 am EST
I have some images defined in my WPF project’s App.xaml like this:
<ControlTemplate x:Key="Open_32x">
<Viewbox Width="32" Height="32" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Rectangle Width="32" Height="32">
<Rectangle.Fill>
<DrawingBrush>
<DrawingBrush.Drawing>
<DrawingGroup>
<DrawingGroup.Children>
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M22.8711,21L32.0001,11.828 32.0001,10.172 22.8711,1 11.2151,1 17.2151,7 12.0431,7C5.4261,7 0.043099999999999,12.383 0.043099999999999,19 0.043099999999999,25.617 5.4261,31 12.0431,31L14.0001,31 14.0001,23 12.0431,23C9.8381,23 8.0431,21.207 8.0431,19 8.0431,16.793 9.8381,15 12.0431,15L17.2151,15 11.2151,21z" />
<GeometryDrawing Brush="#FF00529C" Geometry="F1M22.043,3L16.043,3 22.043,9 12.043,9C6.52,9 2.022,13.477 2.022,19 2.022,24.523 7,29 12,29L12,25C9,25 6.022,22.313 6.022,19 6.022,15.686 8.729,13 12.043,13L22.043,13 16.043,19 22.043,19 30.043,11z" />
</DrawingGroup.Children>
</DrawingGroup>
</DrawingBrush.Drawing>
</DrawingBrush>
</Rectangle.Fill>
</Rectangle>
</Viewbox>
</ControlTemplate>
I’m using them with toolbar buttons like this:
<c1:C1ToolbarButton x:Uid="OpenFile" Margin="2" Click="OnToolbarButtonClick" ToolTip="Open a file">
<ContentControl Template="{StaticResource Open_32x}"/>
</c1:C1ToolbarButton>
I would like to use these for my C1MenuItems as well; however, I don’t know how to do so. Setting the Icon property to {StaticResource (or DynamicResource) Open_32x} doesn’t work because they’re not seen as images by the class.
Is it possible to do what I want? If so, can you give me a pointer?
Thanks, Marc