UI

WPF-UI

https://github.com/lepoco/wpfui

HandyControl

https://github.com/HandyOrg/HandyControl

图标

Font Awesome

下载压缩包

Font Awesome 下载字体图标

image-20221219140202752

image-20221219140338077

解压下载的文件

在项目中引用

将字体添加至项目中

image-20221219142053295

image-20221219141729866

添加静态资源

1
2
3
4
5
6
7
8
9
<Style x:Key="FA_Regular">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Free Regular" />
</Style>
<Style x:Key="FA_Solid">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Free Solid" />
</Style>
<Style x:Key="FA_Brands">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Brands Regular" />
</Style>

使用方法

在网站搜索图标

image-20221219142705339

点击搜索结果,复制 Unicode

image-20221219142741530

以该图标为例,由于 XAML 不能识别“\”,所以您应该输入“&#xf007;”而不是“\#f007”

image-20221219142850531

示例

1
2
3
4
5
<WrapPanel>
<TextBlock Text="&#xf015;" FontSize="24" Margin="5" Style="{StaticResource FA_Solid}"/>
<TextBlock Text="&#xf11c;" FontSize="24" Margin="5" Style="{StaticResource FA_Regular}"/>
<TextBlock Text="&#xf282;" FontSize="24" Margin="5" Style="{StaticResource FA_Brands}"/>
</WrapPanel>

image-20221219144658844

备注

专业版用户请使用:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<Style x:Key="FA_Solid">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Pro Solid" />
</Style>
<Style x:Key="FA_Regular">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Pro Regular" />
</Style>
<Style x:Key="FA_Light">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Pro Light" />
</Style>
<Style x:Key="FA_Thin">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Pro Thin" />
</Style>
<Style x:Key="FA_Duotone">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Duotone Solid" />
</Style>
<Style x:Key="FA_Brands">
<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/Resources/#Font Awesome 6 Brands Regular" />
</Style>