WPF 使用 fontawesome

这篇博客介绍了如何在WPF应用中通过Nuget包管理器添加FontAwesome5库,然后在窗体中引用该库,使用特定的命名空间,并设置图标属性,展示了一个示例代码,最终展示了运行效果。

1,通过Nuget添加引用

     官网网站:https://github.com/MartinTopfstedt/FontAwesome5

    

2,窗体命名空间区域追加

xmlns:fa="http://schemas.fontawesome.com/icons/"

3,使用

<fa:FontAwesome Icon="Brands_Adn" Margin="15,0,0,1" FontSize="20" Foreground="#1ABC9C" />

4,窗体代码如下:     

<Window x:Class="FontAwesomeTest.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:prism="http://prismlibrary.com/"
        prism:ViewModelLocator.AutoWireViewModel="True"
        xmlns:fa="http://schemas.fontawesome.com/icons/"
        Title="{Binding Title}" Height="350" Width="525" >
    <Grid>
        <fa:FontAwesome Icon="Brands_Adn" Margin="15,0,0,1"  FontSize="20" Foreground="#1ABC9C" />
    </Grid>
</Window>

5,运行效果

     

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值