Bug 28045 - [Android] ImageRenderer assumes that the control is a FormsImageView
Summary: [Android] ImageRenderer assumes that the control is a FormsImageView
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.1
Hardware: All All
: Normal minor
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2015-03-15 04:27 UTC by SilverBleach
Modified: 2015-06-25 12:10 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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description SilverBleach 2015-03-15 04:27:06 UTC
In the implementation of the method Xamarin.Forms.Platform.Android.ImageRenderer.UpdateBitmap(), there is a type cast of this.Control to FormsImageView.

This makes it impossible to override ImageRenderer.OnElementChanged() and use another control (it used to be possible in v1.2).

The easy fix is, instead of ((FormsImageView)this.Control)..., do:

var formsImageControl = this.Control as FormsImageView;
if (formsImageControl != null)

But, you may want to add an interface that FormsImageView implements with the method you want to call. That way, other implementations of ImageView can take advantage of that feature as well.