0

As we are working on Xamarin with font awesome,

we have a Xamarin button with icon. We want to implement font awesome stack icon in Xamarin. How do we do it in Xamarin.

`

<ImageButton>
    <ImageButton.Source>
        <FontImageSource FontFamily="FontAwesome"
                         Glyph="{x:Static fonts:IconFont.AddressBook}"
                         Color="{AppThemeBinding Dark=White,
                                                 Light=Black}"/>
    </ImageButton.Source>
</ImageButton>

` sample which we want :

https://www.w3schools.com/icons/tryit.asp?filename=tryicons_awesome_intro_stack

Srikanth Naidu
  • 787
  • 5
  • 16
  • 28

1 Answers1

1

The code you provided is used to load the font from font file. You could refer to the steps in the link below. https://stackoverflow.com/a/65095438/11850033

It need to download the Font Awesome 4.7.0 first form github.

If you want to load the icon from html, you could use webview.

var browser = new WebView();
var htmlSource = new HtmlWebViewSource();
htmlSource.Html = @"<html><body>
  <h1>Xamarin.Forms</h1>
  <p>Welcome to WebView.</p>
  </body></html>";
browser.Source = htmlSource;

For more details about how to load html, you could check the link below.https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=windows#html-strings

Wendy Zang - MSFT
  • 10,509
  • 1
  • 7
  • 17