Reputation: 737
I'm trying to set the icon for a toolbar item and hit a snag. I'd like to load the image from an "icon pack" downloaded by the user. I have the icons downloading properly, but they don't seem to load for the display.
var tb = new Forms.ToolbarItem();
tb.Icon = new Forms.FileImageSource { File = "add.png" };
It does, however, seem to work when I manually mark them as an android resource in the build (which I would not be able to allow users to use "icon packs" I would presume). Is it not possible to use the FileImageSource for local files?
Upvotes: 3
Views: 2614
Reputation: 89082
FileImageSource will not work with paths from outside the app bundle. If you want to load images that are not in the bundle, use a StreamImageSource and use DependencyService to provide a stream from a path for each platform.
Upvotes: 4