Hello,
I am experimenting with the SfTabView control, using the sample code from SampleBrowser, but I have been unable to find an efficient way to specify the font glyphs that should be used as SfTabItem icons.
The sample application specifies icon glyphs using the text characters that correspond to the Unicode glyph codes in the associated ttf file.
For example, the sofa icon in the TabIcons.ttf file has a Unicode glyph code of \u0041, which usually represents text character A.
So, this can be specified in XAML as follows:
<tabView:SfTabItem IconFont="A" FontIconFontFamily="TabIcons.ttf#"TabIcons></tabView:SfTabItem>
This approach is OK when a required icon glyph nicely maps to a printable character.
However, I am not sure how I can make it work in a real-world app that uses an icon library such as FontAwesome, in which each glyph has a name and a Unicode glyph code, but neither of them seem to be recognized by SfTabItem.
Here are some of the things that I have tried:
[a] Specify the Unicode glyph code as an XML-escaped value directly in XAML (doesn't work):
<tabView:SfTabItem IconFont=")" FontIconFontFamily="TabIcons.ttf#"TabIcons></tabView:SfTabItem>
[b] Specify the glyph by its name, as defined in the font file (doesn't work):
<tabView:SfTabItem IconFont="sofa" FontIconFontFamily="TabIcons.ttf#"TabIcons></tabView:SfTabItem>
[c] Bind the IconFont property to a view model property that returns the character to be rendered (doesn't work):
<tabView:SfTabItem IconFont="{Binding SofaGlyph}" FontIconFontFamily="TabIcons.ttf#"TabIcons></tabView:SfTabItem>
And then, in the view model ...
public char SofaGlyph => Convert.ToChar(0x0041);
The icon support in SfTabView looks great, but I am not clear how to make it play nicely with the many popular font icon libraries.
Can you please tell me what I am doing wrong? Many thanks in advance.