Skip to content

JimmyPun610/XF.TextIcon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

XF.TextIcon

Xamarin Forms Library for Icon font Works in Android and iOS Required Xamarin.Forms 3.5.0.274416 or above

Supporting Font

  1. Ionicon https://ionicons.com/
  2. FontAwesome 5 Free https://fontawesome.com/icons
  3. Icon8 Windows 10 https://github.com/icons8/windows-10-icons
  4. Google Material Icon https://material.io/tools/icons/?style=baseline
  5. IcoFont https://icofont.com/

Support UI Control

  1. Span
  2. Label

Setup

  1. Forms Project
  • Install Nuget Package
Install-Package XF.TextIcon.Forms -Version 1.0.0.0
  1. Android Project
  • Add Fonts to Asset Folder and make sure Build Action is AndroidAsset
  1. iOS Project
  • Add Fonts to Resources folder and make sure Build Action is BundleResource
  • Insert below to info.plist
<key>UIAppFonts</key>
  <array>
  	<string>ionicons.ttf</string>
  <string>icons8-win10.ttf</string>
  <string>icofont.ttf</string>
  <string>GoogleMaterial.ttf</string>
  <string>FontAwesome5FreeRegular.otf</string>
  <string>FontAwesome5FreeSolid.otf</string>
  <string>FontAwesome5FreeBrand.otf</string>
</array>

How to use

To use in xaml, you may set the icon as below. The IconName can be check from CheatSheet.

  <Label>
           <Label.FormattedText>
               <FormattedString>
                   <texticon:IconSpan IconType="IonicIcon" IconName="ion-ios-arrow-round-forward" FontSize="Large"/>
                   <texticon:IconSpan IconType="Icon8Win10" IconName="icons8-win10-clipboard" FontSize="Large"/>
                   <texticon:IconSpan IconType="IcoFont" IconName="icofont-gift-box" FontSize="Large"/>
                   <texticon:IconSpan IconType="GoogleMaterial" IconName="material-add_shopping_cart" FontSize="Large"/>
                   <texticon:IconSpan IconType="FontAwesomeBrand" IconName="fontawesome5-free-brand-facebook" FontSize="Large"/>
                   <texticon:IconSpan IconType="FontAwesomeRegular" IconName="fontawesome5-free-regular-calendar-check" FontSize="Large"/>
                   <texticon:IconSpan IconType="FontAwesomeSolid" IconName="fontawesome5-free-solid-angry" FontSize="Large"/>
               </FormattedString>
           </Label.FormattedText>
       </Label>
       <texticon:IconLabel IconType="FontAwesomeSolid" IconName="fontawesome5-free-solid-angry" FontSize="Large"/>

Further improvement

Please let me know if any request on different fonts, providing the otf / ttf file will be nice.