How can I use platform icons for ToolBarItems in Xamarin.Forms (programmatically)?

What do I have:

I have an app Xamarin.Forms

with ToolBar

( ActionBar

on Android, Navigation Bar

on iOS). Inside ToolBar

I have ToolBarItem

to remove something.

What I want:

For the above, ToolBarItem

I want to use native platform icons (like a trash can).

My question is:

What's the correct way to achieve this? It seems like the only way to do this is to add and upload separate png files as described here . For Android, it doesn't really matter, I can officially download the icon files from the google developer page. This is not possible for iOS.

+3


source to share


1 answer


This is almost impossible to override at present. By looking at the source ToolbarRenderer

, you can see the method UpdateItems

. This assumes that all toolbox items are of type ToolbarItem

and do not call their own renderer on them, but instead call directly to the extension method that converts the values ToolbarItem

to UIBarButtonItem

containing UIImage

.



+2


source







All Articles