- Home
- Forum
- Xamarin.Forms
- FontIconText icon not showing when initialized via c#
FontIconText icon not showing when initialized via c#
This works in Xaml:
<radialMenu:SfRadialMenuItem ItemTapped="OnSaveRadialMenuItemTapped" FontIconText="i" IconFontFamily="{StaticResource customfontfamily}"></radialMenu:SfRadialMenuItem>
However when I try the same thing in C# it only shows "i" not the icon:
string iconFontFamily = Device.RuntimePlatform == Device.Android ? "Edsembli" : "Edsembli.ttf";
item = new SfRadialMenuItem()
{
FontIconText = "i",
IconFontFamily = iconFontFamily,
};
itemCollection.Add(item);
SIGN IN To post a reply.
5 Replies
MK
Muneesh Kumar G
Syncfusion Team
August 12, 2019 07:12 AM UTC
Hi Mario,
Greetings from Syncfusion.
We have analyzed your requirement “FontIconText string in C# doesn't working in SfRadialMenu” from our side. We have prepared the sample for your reference. Please try the attached below sample and let us know if you have any concern on this.
Code snippet:
|
public partial class MainPage : ContentPage
{
SfRadialMenu radialMenu = new SfRadialMenu();
public MainPage()
{
InitializeComponent();
Grid grid = new Grid();
radialMenu.CenterButtonFontFamily = Device.RuntimePlatform == Device.Android ? "radialmenu_Segoe MDL2 Assets.ttf" : Device.RuntimePlatform == Device.iOS ? "Segoe MDL2 Assets" : "radialmenu_Segoe_MDL2_Assets.ttf#Segoe MDL2 Assets";
radialMenu.CenterButtonText = "\uE713";
radialMenu.CenterButtonRadius = 32;
string[] radialMenuItems = new string[] { "\uE734", "\uE700", "\uE72d", "\uE735", "\uE700", "\uE73a" };
for (int itemCount = 0; itemCount < radialMenuItems.Count(); itemCount++)
{
radialMenu.Items.Add(new SfRadialMenuItem()
{
FontIconText = radialMenuItems[itemCount],
IconFontSize = 25,
IconFontFamily = Device.RuntimePlatform == Device.iOS ? "Segoe MDL2 Assets" :
Device.RuntimePlatform == Device.Android ? "radialmenu_Segoe MDL2 Assets.ttf" :
"radialmenu_Segoe_MDL2_Assets.ttf#Segoe MDL2 Assets"
});
}
grid.Children.Add(radialMenu);
this.Content = grid;
}
}
|
Sample Link:
Please let us know if you have any queries.
Thanks,
Muneesh Kumar G.
MA
Mario
August 14, 2019 02:40 PM UTC
That doesn't really answer my question because you are using something that I already seen in the documentation. My character map is attached. How does that translate to codes in your example?
Attachment: Capture_b998bf0d.zip
ie. I'm going from "i" to " "\uE734"?
Attachment: Capture_b998bf0d.zip
MK
Muneesh Kumar G
Syncfusion Team
August 15, 2019 05:14 AM UTC
Hi Mario,
Thanks for the update.
In last update you have attached the image of the FontFamily file. For this please share us the custom FontFamily file with the text code. It will help us to provide the sample to explain you clearly.
Thanks,
Muneesh Kumar G.
MA
Mario
August 15, 2019 01:19 PM UTC
font family file is attached. The Capture_b998bf0d.zip contains a screenshot with the text codes.
Attachment: Edsembli_48db5a88.zip
Attachment: Edsembli_48db5a88.zip
MK
Muneesh Kumar G
Syncfusion Team
August 19, 2019 07:22 AM UTC
Hi Mario,
Thanks for your update.
We have analyzed your requirement “FontIconText string in C# doesn't working in SfRadialMenu” from our side. We have modified the sample with given FontFamily file. Please try the attached below sample and let us know if you have any concern on this.
Code Snippet:
|
Grid grid = new Grid();
radialMenu.CenterButtonFontFamily = Device.RuntimePlatform == Device.Android ? "Edsembli.ttf" : Device.RuntimePlatform == Device.iOS ? "Edsembli" : "Edsembli.ttf#Edsembli";
radialMenu.CenterButtonText = "h";
radialMenu.CenterButtonRadius = 32;
radialMenu.SelectionColor = Color.Red;
string[] radialMenuItems = new string[] { "i", "j", "k", "p", "r", "l" };
for (int itemCount = 0; itemCount < radialMenuItems.Count(); itemCount++)
{
radialMenu.Items.Add(new SfRadialMenuItem()
{
FontIconText = radialMenuItems[itemCount],
IconFontSize = 25,
IconFontFamily = Device.RuntimePlatform == Device.Android ? "Edsembli.ttf" : Device.RuntimePlatform == Device.iOS ? "Edsembli" : "Edsembli.ttf#Edsembli"
});
}
grid.Children.Add(radialMenu);
this.Content = grid; |
Sample Link:
Please refer below image for above sample:
Please let us know if you have any other queries.
Thanks,
Muneesh Kumar G.
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
MA Mario
- Aug 9, 2019 02:53 PM UTC
- Aug 19, 2019 07:22 AM UTC