[WPF] 使用Fontawesome 圖示

之前介紹過Fontawesome 是一套Bootstrap 的icon library. 然而只限於web application 中使用. 在正常情況下, 在WPF中亦須要render SVG file.

Font-Awesome-WPF 是一套將fontawesome 轉至WPF 的library, 於 XMAL 中叫用方法如下:

<Window x:Class="Example.FontAwesome.WPF.Single"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:fa="http://schemas.fontawesome.io/icons/"
        Title="Single" Height="300" Width="300">
    <Grid  Margin="20">
        <fa:ImageAwesome Icon="Flag" VerticalAlignment="Center" HorizontalAlignment="Center" />
    </Grid>
</Window>

 

參考資料

Font-Awesome-WPF, Github, https://github.com/charri/Font-Awesome-WPF

About C.H. Ling 260 Articles
a .net / Java developer from Hong Kong and currently located in United Kingdom. Thanks for Google because it solve many technical problems so I build this blog as return. Besides coding and trying advance technology, hiking and traveling is other favorite to me, so I will write down something what I see and what I feel during it. Happy reading!!!

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.