wpf 使用Font-Awesome圖標字體

wpf 使用Font-Awesome圖標字體css

一、http://fontawesome.io/ 中下載Font-Awesome字體html

而後把字體文件fontawesome-webfont.ttf 拷貝到項目中web

build action 設置爲Resourcec#

並設置「複製到輸出目錄」爲「若是較新則複製」 或者 copy alwaysapp

全部圖標對應的值內容地址字體

http://www.bootcss.com/p/font-awesome/design.htmlui

\<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="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\<TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
\</WrapPanel> 
\</Window>
相關文章
相關標籤/搜索