Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

How to assign an embedded image to a ContentPage Icon?

$
0
0

The image that I want to assign as the icon of a tabbed page is an embedded resource in a separate assembly because it is part of an sdk.

Ordinarily, to get an embedded image I'd merely go:

var myImageSource = ImageSource.FromResource("ProjectNamespace.DottedFolderPath.Filename.png");

However the TabbedPage picks up the Icon for the selected ContentPage as being the Icon property of the page, and this is a FileImageSource - which for the life of me I haven't been able to cast.

I want to be able to do all of the image loading from the code behind of the TabbedPage (yes, MVVM sacrilege), but this is so that I can easily expedite the loading of unselected images as well, using the TabbedPage Children index.

Can anyone show me how to load an embedded image from another assembly into a ContentPage's Icon property?


Viewing all articles
Browse latest Browse all 77050

Trending Articles