I am trying to use FontAwesome5 in a new Maui project. When I reference a glyph in the xaml literally, the icon renders just fine. However, when I attempt to have it backed by a Static class resource the glyph is not rendered and instead a string is rendered.
So this renders the icon correctly:
<Image Grid.Column="1" WidthRequest="40" HeightRequest="40" Margin="5,5,10,5" VerticalOptions="Center">
<Image.Source>
<FontImageSource FontFamily="{x:Static font:FontAwesome.Duotone}" Glyph="" />
</Image.Source>
</Image>
But when moving it to a reference it does not:
<Image Grid.Column="1" WidthRequest="40" HeightRequest="40" Margin="5,5,10,5" VerticalOptions="Center">
<Image.Source>
<FontImageSource FontFamily="{x:Static font:FontAwesome.Duotone}" Glyph="{x:Static font:FontAwesome.Share}" />
</Image.Source>
</Image>
Where FontAwesome.Share
is in a static class containing:
[XamlCompilation(XamlCompilationOptions.Compile)]
public static class FontAwesome
{
// ...
public static string Share = "";
// ...
}
Any ideas?