WPF (.Net and .Net Core), UWP and WinUI controls for the web's most popular icon set and toolkit.
Font-Awesome Version: 6.1.1
The Package is now separated into two separate packages for SVG and Fonts. Therefore the namespace needed to be separate as well. Which means the old namespace http://schemas.fontawesome.com/icons
has been split into http://schemas.fontawesome.com/icons/svg
and http://schemas.fontawesome.com/icons/fonts
.
Install the FontAwesome6.Svg package: Install-Package FontAwesome6.Svg
Control | .Net Framework & .Net | WinUI | UWP |
---|---|---|---|
SvgAwesome | ✅ | ✅ | ✅ |
ImageAwesome | ✅ | ❌ | ❌ |
<Window x:Class="FontAwesome6.Example.WPF.MainWindow"
xmlns:fa="http://schemas.fontawesome.com/icons/svg">
<fa:ImageAwesome Icon="Solid_Flag" />
<fa:SvgAwesome Icon="Solid_Flag" />
</Window>
See example projects for advanced usage.
Available for following controls:
- Image
- Viewbox
- all controls which inherit ContentControl, e.x. Button.
<Window x:Class="FontAwesome6.Example.WPF.MainWindow"
xmlns:fa="http://schemas.fontawesome.com/icons/svg/properties">
<Button fa:FontAwesome.Icon="Soild_Flags"/>
<Image fa:FontAwesome.Icon="Soild_Flags"/>
</Window>
See example projects for advanced usage.
Available converters:
- DrawingConverter
- IconNameConverter
- ImageSourceConverter
- StyleConverter
- VisibilityConverter
<Window x:Class="FontAwesome6.Example.WPF.MainWindow"
xmlns:fa="http://schemas.fontawesome.com/icons/svg">
<Window.Resources>
<fa:ImageSourceConverter x:Key="ImageSourceConverter"/>
</Window.Resources>
<Image Source="{Binding SelectedIcon, Converter={StaticResource ImageSourceConverter}}"/>
</Window>
See example projects for advanced usage.
Install the FontAwesome6.Fonts package: Install-Package FontAwesome6.Fonts
Control | .Net Framework & .Net | WinUI | UWP |
---|---|---|---|
FontAwesome | ✅ | ✅ | ✅ |
ImageAwesome | ✅ | ❌ | ❌ |
<Window x:Class="FontAwesome6.Example.WPF.MainWindow"
xmlns:fa="http://schemas.fontawesome.com/icons/fonts">
<fa:ImageAwesome Icon="Solid_Flag" />
<fa:FontAwesome Icon="Solid_Flag" />
</Window>
See example projects for advanced usage.
Available for following controls:
- Image
- all controls which inherit ContentControl, e.x. Button.
<Window x:Class="FontAwesome6.Example.WPF.MainWindow"
xmlns:fa="http://schemas.fontawesome.com/icons/fonts/properties">
<Button fa:FontAwesome.Icon="Soild_Flags"/>
<Image fa:FontAwesome.Icon="Soild_Flags"/>
</Window>
See example projects for advanced usage.
Available converters:
- DrawingConverter
- IconNameConverter
- ImageSourceConverter
- StyleConverter
- VisibilityConverter
<Window x:Class="FontAwesome6.Example.WPF.MainWindow"
xmlns:fa="http://schemas.fontawesome.com/icons/fonts">
<Window.Resources>
<fa:ImageSourceConverter x:Key="ImageSourceConverter"/>
</Window.Resources>
<Image Source="{Binding SelectedIcon, Converter={StaticResource ImageSourceConverter}}"/>
</Window>
See example projects for advanced usage.
The FontAwesome6.Pro.Svg NuGet package does not include any icon svg data. You need to provide the FontAwesome6 Pro svg data by yourself. (see Installation)
-
Install the FontAwesome6.Pro.Svg package:
Install-Package FontAwesome6.Pro.Svg
-
Download the Desktop Version of FontAwesome6 from the website: https://fontawesome.com/download
-
Extract the FontAwesome6 into "Font-Awesome-Pro" and execute the
FontAwesome6.Generator.exe
.-
FontAwesome Version: specify the version for the generation. e.x. 6.0.0-beta3
-
Activate the Pro Version check box
-
Source Dictionary:
-
FontAwesome Svg Directory: the directory of all FontAwesome Svg files. e.x. Font-Awesome-Pro/svgs
-
Output Directory: the directory where the svg files get saved to.
-
-
The generated
FontAwesome6Svg.json
should be integrated into your project as content or embedded resource. -
Proceed with the setup
The FontAwesome6.Pro.Fonts NuGet package does not include any font files. You need to provide the FontAwesome6 Pro otf files by yourself. (see Installation)
-
Install the FontAwesome6.Pro.Fonts package:
Install-Package FontAwesome6.Pro.Fonts
-
Download the Desktop Version of FontAwesome6 from the website: https://fontawesome.com/download
-
Include all needed FontAwesome6 Style otf files(ex: Font Awesome 6 Pro-Solid-900.otf) inside you project as "Content" and "Copy always".
-
Proceed with the setup
The example below shows how to load all font files(with their default names) from the "Fonts" directory, which is located besides the executing assembly location.
public partial class App : Application
{
public App()
{
var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
FontAwesome6.Fonts.FontAwesomeFonts.LoadAllStyles(Path.Combine(directory, "Fonts") + "/");
}
}
⚠️ (.Net Framework & .Net only) Using the fonts from resources will create a memory leak. To prevent it load the font from the file system instead.
The example below shows how to load all font files(with their default names) as resource. The files are located inside the solution in the "Fonts" directory and have "Resource" as Content.
public partial class App : Application
{
public App()
{
FontAwesome6.Fonts.FontAwesomeFonts.LoadAllStyles(new Uri("pack://application:,,,/Fonts/"));
}
}
public sealed partial class MainPage : Page
{
public MainPage()
{
Fonts.FontAwesomeFonts.LoadFonts(new Uri("ms-appx:///Fonts/"));
}
}
<Window x:Class="FontAwesome6.Example.WPF.MainWindow"
xmlns:fa="http://schemas.fontawesome.com/icons/svg">
<fa:ImageAwesome Icon="Duotone_Flag"
PrimaryColor="Black"
SecondaryColor="Green"
PrimaryOpacity="1"
SecondaryOpacity="0.4"
SwapOpacity="false"/>
</Window>
<Window x:Class="FontAwesome6.Example.WPF.MainWindow"
xmlns:fa="http://schemas.fontawesome.com/icons/fonts">
<fa:ImageAwesome Icon="Duotone_Flag"
PrimaryColor="Black"
SecondaryColor="Green"
PrimaryOpacity="1"
SecondaryOpacity="0.4"
SwapOpacity="false"/>
</Window>