FontAwesome.UWP 按钮内的图标

FontAwesome.UWP icon inside a button

我是 UWP 开发的菜鸟。我已经制作了一个应用程序,但现在是时候更换造型师了。我想在我的关于页面(Facebook、Twitter 等)中制作社交按钮。我已经安装了 FontAwesome.UWP 来自 Nuget 包的引用。

例如,我插入了我的 Facebook 图标,代码如下:

<fa:FontAwesome Icon="FacebookOfficial"
                Name="facebookIcon"
                RelativePanel.Below="feedbackButton"
                Margin="10,20,0,0"
                FontSize="30"
                HorizontalAlignment="Center"
                Height="40" Width="40"/>

现在我的问题是我找不到如何将此图标绑定到按钮的内容 属性。

有什么想法吗?

编辑。我在按钮内添加了这样的内容:

<Button>
        <fa:FontAwesome Icon="FacebookOfficial"
                    Name="facebookIcon"
                    RelativePanel.Below="feedbackButton"
                    Margin="10,20,0,0"
                    FontSize="30"
                    HorizontalAlignment="Center"
                    Height="40" Width="40"/>
</Button>

FontAwesome.UWP 专门用于使用 FontSizes 基于名称创建 GlyphIcons。(至少这是我从 GitHub 文档中了解到的)。

如果这是真的,您不必在 FontAwesome 上设置宽度和高度,而是使用 FontSize 来获得您想要的 WidthHeight

另外,您的 RelativePanel.Below="feedbackButton" 应该设置在 Button 而不是 FontAwesome

因此您的最终按钮代码将如下所示。

<Button HorizontalAlignment="Center" VerticalAlignment="Center">
    <Button.Content>
        <fa:FontAwesome Icon="FacebookOfficial"
            Name="facebookIcon"
            FontSize="30" />
    </Button.Content>
</Button>