'New Feature in Xamarin.Form with Fontawesome 5 not working
I would like to use the new feature in Xamarin.Forms enabling Fonts cross-platform but I can't get it to work properly.
Version Xamarin.Forms: 4.7.0.1080
Here's part of my code.
<Button Text=""
FontFamily="FA5Regular"
Command="{Binding Path=BindingContext.Delete, Source={x:Reference SongsCollectionView}}"
CommandParameter="{Binding .}"
Grid.Column="3" Grid.Row="0" StyleClass="Delete"/>
In app.xaml.cs:
[assembly: ExportFont("Font Awesome 5 Free-Regular-400.otf", Alias = "FA5Regular")]
[assembly: ExportFont("Font Awesome 5 Free-Solid-900.otf", Alias ="FA5Solid")]
namespace eTabber
{
public partial class App : TxfApplication
{
...
Styling:
Button {
background-color: darkslateblue;
color: white;
border-radius: 5;
}
Button.Delete {
background-color: red;
}
In the solution:
It should produce a button with a trashcan (far fa-trash-alt) but it produces a rectangle.
== EDIT ==
It maybe very well possible the alias from the ExportFontAttribute (FA5Regular) should be different. I don't see it anywhere at runtime:
== EDIT ==
Decompiled with JustDecompile and I do see the fonts in the eTabber.dll:
== Edit ==
There's part of an answer here but can't get that to work either.
Solution 1:[1]
You have font awesome licence issue, Try with "solid" icons, many of them regular doesn't support.
https://fontawesome.com/download
You can find all icon code in a code files and information
https://github.com/matthewrdev/fa2cs
For example; Four support only Solid for free lib.
/// <summary>
/// fa-4 unicode value ("\u0034").
/// <para/>
/// This icon supports the following styles: Light (Pro), Regular (Pro), Solid, Duotone (Pro), Thin (Pro)
/// <para/>
/// Introduced in '6.0.0-beta1', Last Modified in '6.0.0-beta1'.
/// <para/>
/// See https://fontawesome.com/icons/4
/// </summary>
public const string Four = "\u0034";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |





