Learn wpf--using font-awesome icon font

Source: Internet
Author: User

Icon Font Introduction
before introducing the icon font, we have to introduce the icon format Iconicon is an icon format, our operating system in various applications include an icon such as the QQ program icon is a lovely penguin, My computer is a monitor icon----------------an icon file is the extension. ico or icon files until now icon files are everywhere in the computer program but sometimes it is necessary to enlarge the icon without distortion because icon itself differs little from the graphics file in the jpeg\png format, is also non-vector graphics so the icon file is difficult to meet this demand----------------in order to solve this problem, there is the author of the graphic information into the font of the font-awesome we are going to use today is the technical form of a realization (of course, there are other ways to solve this problem , such as using CSS3 to draw icons, but that technical form is more difficult to apply to the client program)----------------Common icon fonts have a lot, but I think font-awesome is by far the most outstanding icon font (no one) icons, icons Beautiful, Compatible with a variety of application scenarios is its main

Using the Font-awesome icon font in WPF

I used it in QT applications once. font-awesome icon Font, very convenient to use, showing the effect as expected However, using an icon font in a WPF application is displayed as a box, such asLater, only to find a solution: first to the Font-awesome official website Download the font program to download the compressed package, extract the icon font file and then copy the font file into the project and set "Copy to output directory" as "If newer copy" and then edit the program code:
<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= "></setter>", < Setter property= "Textblock.height" value= "></setter>", < Setter property= "textblock.textalignment" value= "Center" ></SETTER> <setter property= "textblock.fontsize" value= "></setter>"; Span style= "line-height:1.5;" ><setter property= "Textblock.foreground" value= "Green" ></SETTER> </STYLE>
</Window.Resources> <wrappanel margin= ">" 
<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>
Run the program, see the icon, done

Modify a record

2015-12-26: Write a sample program to complete part of the content of the article 2014-12-29: Modify part of the content, modify the document format

Resources

Add-icon-font-in-wpfchanging-font-icon-in-wpf-using-font-awesome
 
   

Learn wpf--using font-awesome icon font

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.