Skip to content Skip to sidebar Skip to footer

How To Change Icon Of Secondary Toolbaritem Xamarin Forms

I am trying to set a custom icon to a 'Secondary' Order Toolbaritem on a ContentPage, but the icon is rendered as the 3-dot /dotted-list icon on Android every time (haven't deploye

Solution 1:

That 3-dot icon (Kebab menu icon) is a menu icon. Order="Secondary" moves toolbar item to secondary surface, on Android that secondary surface is kebab menu. And microsoft docs have this to say about toolbar items on secondary surface:

Icon behavior in ToolbarItem objects that have their Order property set to Secondary is inconsistent across platforms. Avoid setting the IconImageSource property on items that appear in the secondary menu.

On Android items are placed in kebab menu and icons are not displayed, while on iOS secondary items are placed just below main toolbar and icons are displayed. I'm not sure about UWP, I currently do not have a way to test it. If what you want is consistent look with icons across all platforms you will have to implement your own toolbar.

EDIT: This Xamarin.Forms git issue asks for exactly that functionality. Issue seems old but it's still open and there's still some activity, so maybe someday it will be possible to add icons to secondary ToolbarItem on android. In the meantime, they suggest a workaround - use primary ToolbarItem with "Kebab menu" logo which when clicked toggles IsVisible property on custom ListView menu positioned with RelativeLayout where your menu should be.

Post a Comment for "How To Change Icon Of Secondary Toolbaritem Xamarin Forms"