Unable to bind `Glyph` property in `FontImageSource` of `ToolbarItem`
See original GitHub issueDescription
Original discussion: https://forums.xamarin.com/discussion/180852/why-glyph-property-in-fontimagesource-doesnt-bind Xamarin issue: https://github.com/xamarin/Xamarin.Forms/issues/12700
This code doesn’t produce any errors, but Glyph is always empty:
<ContentPage.ToolbarItems>
<ToolbarItem IconImageSource="{FontImageSource Glyph={Binding MyIcon}, FontFamily=MaterialDesignIcons}" />
</ContentPage.ToolbarItems>
Static binding works fine. Code above also works if it’s added via Hot Reload (but after proper app reload icon is gone again)

Steps to Reproduce
- Add
ToolbarItemto your page - Specify
IconImageSourceto it asFontImageSourcewith bindedGlyph
Link to public reproduction project repository
Remove the converter and start the app: https://github.com/maxkoshevoi/NureTimetable/blob/5f67cadbb78bc3c37df4985adf8c4ce3a936b4a0/NureTimetable/UI/Views/Timetable/TimetablePage.xaml#L20
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
All (tested on 13)
Did you find any workaround?
Thanks Saskia.
<ToolbarItem IconImageSource="{Binding MyIcon, Converter={converters:ToolbarIconValueConverter}}" />
public class ToolbarIconValueConverter : IValueConverter, IMarkupExtension
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return new FontImageSource
{
FontFamily = (OnPlatform<string>)Application.Current.Resources["MaterialFontFamily"],
Glyph = (string)value
};
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
public object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
}
Relevant log output
No response
Issue Analytics
- State:
- Created a year ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
Why Glyph property in FontImageSource doesn't bind?
Hi community. I have a strange behavior with FontImageSource. I can't get property binded to Glyph. <ContentPage.
Read more >Issue with FontImageSource Glyph when using a Binding
Using Xamarin Forms 5 and Visual Studio 2022. I have added the materialdesignicons-webfont.ttf to a Fonts folder of the PCL project only and ......
Read more >Xamarin Unable to change the color of the ToolBarItem ...
I have the following XAML code which gives me a toolbar and unfortunately, it doesn't change the color of the icon. Code <ToolbarItem...
Read more >FontImageSource Glyph icon with data binding, only ...
My problem is, that not the actual Glyph icon, but its unicode (a simple string) is displayed on the UI. The toggle favorite...
Read more >Adding an icon font to your Xamarin Forms apps
Create glyph resources to identify each icon ysou want to use. Let's take an example. ... Right-click on the font, then select Properties....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry I tested it with regular image not with toolbar, but it’s not working with toolbar I’m sorry for that
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: Maksym @.> Sent: Wednesday, November 9, 2022 10:32 AM To: @.> Cc: Michael @.>; @.> Subject: Re: [dotnet/maui] Unable to bind
Glyphproperty inFontImageSourceofToolbarItem(Issue #10186)Yes it’s working without converter
Could you please share a sample project? It doesn’t work on my side as I’ve described here: #10186 (comment)https://github.com/dotnet/maui/issues/10186#issuecomment-1268835353
— Reply to this email directly, view it on GitHubhttps://github.com/dotnet/maui/issues/10186#issuecomment-1308391797, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADRJJRWYWAM3APJ7D2AHCS3WHNOTRANCNFSM6AAAAAAQPE72UI. You are receiving this because you were mentioned.Message ID: @.***>
My bad, you were talking about dynamic binding for glyph. Sorry