Learn WPF-Use Font-Awesome icon Font, wpffont-awesome

Source: Internet
Author: User

Learn WPF-Use Font-Awesome icon Font, wpffont-awesome
Icon font description

Before introducing the icon font, I have to introduce the ICONICON format. In our operating system, various applications contain an icon. For example, the icon of the QQ program is a cute penguin, my computer is a display icon -------------- an icon file is extension. ICO or ICON files can still be seen everywhere in computer programs until now, but sometimes it is necessary to enlarge the ICON without losing sight of it because the ICON itself is not very different from the JPEG \ PNG format, it is also a non-vector image, so it is difficult for the icon file to meet this requirement -------------- to solve this problem, some authors put the graphic information in the Font, And the Font-Awesome we will use today is an implementation of this technical form (of course there are other ways to solve this problem, for example, if you use css3 to draw an icon, it is difficult to apply it to the client program.) -------------- there are many common icon fonts, however, I think Font-Awesome is by far the most outstanding icon Font (none) with many icons, beautiful icons, and compatibility with various application scenarios.

Use Font-Awesome icon Font in WPF

I used the Font-Awesome icon Font in the Qt application, which is very convenient to use, the display effect is as expected, but using the icon font in the WPF application will display a box, as shown in<Window x: Class = "WpfApplication1.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>
Modify record

: Compile the sample program and complete part of the article content: modify part of the content, modify the document format

References

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

Related Article

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.