wpf controls - how use icon [Font-awesome] in WPF -


i new in wpf. want use font-awesome icon in textbox , button. icon not bind textbox

i install font-awesome resource application.

let me know way how can use it

thank you,

i need please me..

example

step 1 : download font-awesome

tools -> library package manager -> package manager console install

pm > install-package fontawesome.wpf

step 2 : add resource

<application> xmlns:fa="http://schemas.fontawesome.io/icons/" </application> 

step 3 : put app.xaml

<application.resources>      <style x:key="fontawesome">         <setter property="textelement.fontfamily" value="pack://application:,,,/fonts/#fontawesome" />     </style>  </application.resources> 

step 4 : use in demo.xaml

<textblock style="{staticresource fontawesome}" fontsize="75" text="&#xf133;" /> 

step 5 :- output

my output

first, download font awesome, extract zip file , copy fonts/fontawesome-webfont.ttf fonts folder in solution. set build action in properties resource if isn’t already

enter image description here

next, add style resources in app.xaml. don’t forget # @ front of font name , remember use internal name of font, not name of file. check name of font, double click on font file , open in windows font viewer. font name @ top.

enter image description here

<application.resources> <fontfamily x:key="fontawesome">/fonts/fontawesome-webfont.ttf#fontawesome</fontfamily> </application.resources> 

open mainwindow.xaml , replace grid below snippet:

<grid verticalalignment="center" horizontalalignment="center">  <stackpanel orientation="horizontal" >  <textblock text="i" fontsize="32" margin="10" verticalalignment="center"></textblock>   <textblock x:name="tbfontawesome" text="&#xf004;" fontfamily="{staticresource fontawesome}" foreground="red" fontsize="32" margin="10" verticalalignment="center"></textblock> <textblock text="font awesome" fontsize="32" margin="10" verticalalignment="center"></textblock>  </stackpanel>  </grid> 

notice "text" property of "tbfontawesome" textblock, unicode heart.

cheat sheet


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -