wpf 使用Font-Awesome图标字体
1、http://fontawesome.io/ 中下载Font-Awesome字体
然后把字体文件fontawesome-webfont.ttf 拷贝到项目中
build action 设置为Resource
并设置“复制到输出目录”为“如果较新则复制” 或者 copy always
所有图标对应的值内容地址
http://www.bootcss.com/p/font-awesome/design.html
\<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow">
\<Window.Resources>
\<Style x:Key="FontAwesome">
\<Setter Property="TextElement.FontFamily" Value="pack://application:,,,/#FontAwesome" />
\<Setter Property="TextBlock.Width" Value="100"></Setter>
\<Setter Property="TextBlock.Height" Value="100"></Setter>
\<Setter Property="TextBlock.TextAlignment" Value="Center"></Setter>
\<Setter Property="TextBlock.FontSize" Value="60"></Setter>
\<Setter Property="TextBlock.Foreground" Value="Green"></Setter>
\</Style>
\</Window.Resources>
\<WrapPanel Margin="12">
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="" Style="{DynamicResource FontAwesome}" />
\</WrapPanel>
\</Window>