1
votes

I am trying to set the icon for a ToolBarItem to an image loaded from an embedded resource in my Xamarin Forms project. Something like this:

SearchToolbarItem.Icon = ImageSource.FromResource("Namespace.folder.imagename.png");

I am aware that this does not compile, but it gets to heart of what I am trying to do; set an icon to an image loaded from an embedded resource.

I know I could add the image to each individual project (e.g. iOS, Android, etc.) and reference it via a string, but I would prefer just to have one image in the Xamarin Forms project and just use that. Thanks!Q

1

1 Answers

0
votes

The easiest way I found is to create link of the png file in Android resources. Then you just use it as local native resource.