A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hello,
how can I set the value that comes from the database and show the related IconFont?
Based on your IconFont, it is not Enum ,
You can do it by adding a convertvalue method in the IconFont like following code.
static class IconFont
{
// Religion
public const string IconIslam = "\uf699";
public const string IconChristianity = "\uf654";
public const string IconJudaism = "\uf69a";
public static string ConvertIntToIconFont(int glypeFromDB)
{
switch (glypeFromDB)
{
case 1: return IconIslam;
case 2: return IconChristianity;
case 3: return IconJudaism;
default:
return IconIslam;
}
}
}
Then you can use this method to convert int from your DB to string from IconFont
//for testing.
int glypeFromDB = 2;
ImageReligion.Source = new FontImageSource() { FontFamily = "FontSolid", Glyph =IconFont.ConvertIntToIconFont(glypeFromDB), Color = Colors.Black };
Best Regards, Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.