Bug 36168 - Resetting a BindableProperty to null does not trigger OnElementPropertyChanged anymore
Summary: Resetting a BindableProperty to null does not trigger OnElementPropertyChange...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.1
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-11-23 16:00 UTC by Michiel van Vlaardingen
Modified: 2015-11-23 16:08 UTC (History)
3 users (show)

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 Michiel van Vlaardingen 2015-11-23 16:00:46 UTC
We have the following object.

	public class ColorizedImage : Image
		public static readonly BindableProperty ColorProperty =
			BindableProperty.Create<ColorizedImage, Color?>(p => p.Color, null);

		public Color? Color
			get { return (Color?)base.GetValue(ColorProperty);}
			set { base.SetValue(ColorProperty, value);}

Then the custom renderer has:

	protected override void OnElementPropertyChanged
		(object sender, System.ComponentModel.PropertyChangedEventArgs e)
			base.OnElementPropertyChanged(sender, e);

			if (e.PropertyName == ColorizedImage.ColorProperty.PropertyName){ ...

In 1.4.4 this is triggered both by setting the object to a Color  as well as setting  null.   In 1.5.1 it is still triggered by setting a Color, but it is no longer triggered when the property is then changed back from a Color to null.
Comment 1 Michiel van Vlaardingen 2015-11-23 16:08:21 UTC
Seems Resolved in 2.0.0