Mi-krater
Mi-krater

Reputation: 619

Font icons are blank only on the Windows version of .Maui app

In building a .Maui app we have got the windows version working. However unlike the android and IOS version, the windows version is not loading any of our Fontawesome icons.

They are not blank squares like I have seen other people get, they are just totally blank. enter image description here

The MauiProgram.cs has this line:

fonts.AddFont("font-awesome-solid.otf", "font-awesome-solid");

And an example of an icon not working would be this line:

<customcontrols:CustomButton     
  Grid.Column="1"
  Grid.Row="2"
  x:Name="NextButton"
  Text="{x:Static resources:AppResources.buttonTextNextPage}"
  Clicked="OnNextButtonClicked">

  <Button.ImageSource>
    <FontImageSource FontFamily="font-awesome-solid"
      Glyph="{x:Static fonts:FontAwesome.CaretRight}"
      Size="32" />
  </Button.ImageSource>
</customcontrols:CustomButton>

I've tried searching and am now totally stumped, any ideas would be appreciated!

EDIT: I thought I better give what is inside CustomButton as I feel the issue may be there

 public CustomButton() {
        this.SetDynamicResource(VisualElement.StyleProperty, SystemConstant.CustomButtonStyle);
    }

    private string _glyphName = null;

    public string Glyph { 
        get 
        {
            return _glyphName;
        }
        set
        {
            _glyphName = value;
            var fis = new FontImageSource
            {
                FontFamily = "font-awesome-solid#",
                Glyph = value,
                Size = 25,
            };
            fis.SetDynamicResource(FontImageSource.ColorProperty, "LabelTextColor");
            this.ImageSource = fis;
        }
    }

Upvotes: 2

Views: 890

Answers (1)

Mi-krater
Mi-krater

Reputation: 619

Bit of an anticlimactic answer, but it seems that all we did was an update to dotnet as well as some of our libraries. So despite never figuring out what the issue was, the update have resolved the issue and the icons are now visible in windows

Upvotes: 0

Related Questions