Open meiotoha opened 5 years ago
If anyone stumbles upon this I did this
public class MaterialFontImageSource : FontImageSource
{
public MaterialFontImageSource()
{
FontFamily = "iconize-material.ttf#";
}
public string Icon
{
get
{
return base.Glyph;
}
set
{
if(string.IsNullOrEmpty(value))
{
base.Glyph = string.Empty;
}
else
{
if (!value.StartsWith("md-"))
{
value = $"md-{value}";
}
var query = MaterialCollection.Icons.FirstOrDefault(x => x.Key == value);
if (query != null)
{
base.Glyph = $"{query.Character}";
}
else
{
base.Glyph = value;
}
}
}
}
}
This worked for me on Android, you could check for Platform on the constructor to change the font Its usage is as follows
<ToolbarItem.IconImageSource>
<assets:MaterialFontImageSource
Icon="face" Size="12"/>
</ToolbarItem.IconImageSource>
-----------sorry for my mistaken operation Xamarin.Forms 3.6 Iconize 3.5.117 +
A page With
IconLabel
andImage
usingFontImageSource
, both these use a same fontfamily. On Android the icon shown as a [x] symbol,the image is correct. On iOS it seem works.this is the sample xaml
the IconLabel is incorrect on Android . Or I can't use the `iconize-fontawesome-solid.ttf#' or what is the right result to reuse the font file?