I'm trying to put together a ribbon control and I like to use the icons in the IconPack of the MaterialDesign WPF Toolkit. Is there a way that I can get to the icon image itself?
For example: Using a Grid Icon, the code is <materialDesign:PackIcon Kind="Grid" />
.
How do I assign that icon to the ImageSource?
You could use a custom converter as suggested here: https://github.com/MahApps/MahApps.Metro.IconPacks/issues/39.
<Window.Resources>
<local:PackIconImageSourceConverter x:Key="PackIconImageSourceConverter" />
</Window.Resources>
...
<Image Source="{Binding Source={x:Static iconPacks:PackIconMaterialKind.Grid}, Converter={StaticResource PackIconImageSourceConverter}}"
Stretch="None" />
You will find the code for the converter class here: https://gist.github.com/PhyxionNL/160a6f04e6083016d4b2a3aed3c4fe71
EDIT:
This was incorporated into MahApps.Metro
as PackIconKindToImageConverterBase
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With