Xamarin 堆栈图标

Xamarin Stack icon

因为我们正在使用字体很棒的 Xamarin,

我们有一个带图标的 Xamarin 按钮。 我们想在 Xamarin 中实现字体真棒堆栈图标。我们如何在 Xamarin 中做到这一点。

`

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

` 我们想要的样本:

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

您提供的代码用于从字体文件加载字体。您可以参考下面link中的步骤。

需要下载Font Awesome 4.7.0第一个表格github。

如果你想从html加载图标,你可以使用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;

有关如何加载 html 的更多详细信息,您可以查看 link below.https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=windows#html-字符串