ImageConverter - MahApps/MahApps.Metro.IconPacks GitHub Wiki

ImageConverter (only WPF)

The PackIcon image converters can be used to convert a PackIcon enumeration kind to a DrawingImage which can be used with an ImageSource.

  • PackIconBoxIconsKindToImageConverter
  • PackIconEntypoKindToImageConverter
  • PackIconEvaIconsKindToImageConverter
  • PackIconFeatherIconsKindToImageConverter
  • PackIconFontAwesomeKindToImageConverter
  • PackIconIoniconsKindToImageConverter
  • PackIconJamIconsKindToImageConverter
  • PackIconMaterialDesignKindToImageConverter
  • PackIconMaterialKindToImageConverter
  • PackIconMaterialLightKindToImageConverter
  • PackIconMicronsKindToImageConverter
  • PackIconModernKindToImageConverter
  • PackIconOcticonsKindToImageConverter
  • PackIconPicolIconsKindToImageConverter
  • PackIconRPGAwesomeKindToImageConverter
  • PackIconSimpleIconsKindToImageConverter
  • PackIconTypiconsKindToImageConverter
  • PackIconUniconsKindToImageConverter
  • PackIconWeatherIconsKindToImageConverter
  • PackIconZondiconsKindToImageConverter
<StackPanel Orientation="Horizontal">

    <StackPanel.Resources>
        <ObjectDataProvider x:Key="PackIconFontAwesomeKinds"
                            MethodName="GetValues"
                            ObjectType="{x:Type iconPacks:PackIconFontAwesomeKind}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="iconPacks:PackIconFontAwesomeKind" />
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </StackPanel.Resources>


    <ComboBox x:Name="PackIconFontAwesomeKinds"
              Width="200"
              ItemsSource="{Binding Source={StaticResource PackIconFontAwesomeKinds}}"
              VerticalAlignment="Center" />

    <Image VerticalAlignment="Center"
           Width="72"
           Height="72"
           Margin="2"
           Source="{Binding ElementName=PackIconFontAwesomeKinds, Path=SelectedItem, Converter={iconPacks:PackIconFontAwesomeKindToImageConverter Brush=Crimson}}" />

</StackPanel>

2019-12-18_13h10_51

General (generic) ImageConverter (only WPF)

The general (generic) PackIconKindToImageConverter can be used for all PackIcon enumeration kinds. This converter is only available with the MahApps.Metro.IconPacks NuGet package.

<Image VerticalAlignment="Center"
       Width="72"
       Height="72"
       Margin="2"
       Source="{Binding ElementName=PackIconFontAwesomeKinds, Path=SelectedItem, Converter={iconPacks:PackIconKindToImageConverter Brush=Crimson}}" />