I've added FontAwesome 6 to my app and want to use an icon. I have the OTF file in my assets folder here:
I want to change the default symbols (icons) for NavigationViewItems. I added the FontIcon
however instead of the icon, I'm seeing just empty box:
The icon I'm adding is this: https://fontawesome.com/icons/tower-control?s=solid&f=classic
and my code is
<NavigationViewItem Content="Home" Tag="homePageView" x:Name="homeViewItem">
<NavigationViewItem.Icon>
<FontIcon FontFamily="Assets/Fonts/Font Awesome 6 Pro-Solid-900.otf#Font Awesome 6 Pro Solid" Glyph="" />
</NavigationViewItem.Icon>
</NavigationViewItem>
Why is the icon not showing up?
CodePudding user response:
I'm not sure but, have you tried fixing the file extension (.ttf to .otf)?
<FontIcon FontFamily="Assets/Fonts/Font Awesome 6 Pro-Solid-900.otf#Font Awesome 6 Pro Solid" Glyph="" />
UPDATE
I can confirm that this works:
- Download the free version.
- Create a "Fonts" folder inside the "Assets" folder.
- Copy the "Font Awesome 6 Free-Solid-900.otf" file in the "Fonts" folder.
- Use this code below.
<FontIcon FontFamily="Assets/Fonts/Font Awesome 6 Free-Solid-900.otf#Font Awesome 6 Free Solid" Glyph="" />
Note that I'm using Glyph=""
(link) since I couldn't find 
in the free version.
CodePudding user response:
As the FA glyphs were very inconsistent, some glyphs working, some versions of some weights working etc. I've decided to leave Font Awesome and switch to PNG based icons using ImageIcon
.