Bug 37671 - [Enhancement] Change Button Image from FileImageSource to ImageSource
Summary: [Enhancement] Change Button Image from FileImageSource to ImageSource
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: All All
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-01-13 23:45 UTC by Shawn
Modified: 2017-06-22 13:12 UTC (History)
6 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 37671 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Shawn 2016-01-13 23:45:59 UTC
I am unsure as to why the Button object requires a FILE based image source rather than working with a generic ImageSource.  Please considering changing this so that it is possible to use either a FileImageSource, a StreamImageSource, or (hopefully) a custom image source in the future.

This should be a non-breaking change as FileImageSource is based on ImageSource so all existing code should work as expected.
Comment 1 adrianknight89 2016-12-30 02:36:06 UTC
One wonders why anything has to be a FileImageSource. There are icons for example that could use other types of image sources as well.
Comment 2 david 2017-01-02 22:30:17 UTC
This is a long-standing feature request. I've made 2 related requests in the past:


It makes no sense to me that we have an abstract ImageSource class and yet require all image-type assets in stock XF objects to be FileImageSource. The justification for this is apparently that Xamarin doesn't want developers to be able to shoot themselves in the foot by setting UI objects to get their icons from the network. While I understand the concern I do not share it - that's what a cache is for.

The current closed ImageSource ecosystem serves nobody well.

However I believe the design of ImageSource also needs re-thinking, because it contains factory methods that know about and create subclassed objects (FromFile, FromResource, FromStream, FromUri) with some implicit operators to convert between them. This makes the whole ecosystem very hard to extend cleanly and more-or-less ties us to only using the existing (sub)classes.