If you set the BindingContext property of BindableObject to a new object (different object reference) but is equal according the Equals method, the BindingContext will not change. The property for changing the method shouldn't even pay attention to the Equals method because it is not relevant, but if you put a breakpoint on Equals method of any BindingContext, you will see that the XF library is checking for equality on the new BindingContext, and then ignoring the new BindingContext if the Equals method returns true.
-Clone this repo: git clone https://ChristianFindlay@bitbucket.org/ChristianFindlay/xamarin-forms-scratch.git
-Open the solution Test Apps\TestXamarinForms.sln
-Run the UWP sample
-Click the "Binding Context Equality Issue" button
-Notice that the BindingContextEqualityPage_BindingContextChanged event handler is fired
-Click "Change BindingContext Buggy"
-Notice that it calls the Equals method on the model for no reason, and this method returns true because the "Key" property is the same on both models even though the text in "Test" is different
-Click "Change BindingContext OK"
-Notice that the BindingContextEqualityPage_BindingContextChanged event handler is fired because the "Key" property is different between models and therefore the Equals method returns false.
This behaviour is not standard Microsoft bding behaviour. This does not happen in Silverlight, WPF, and UWP.
I can confirm the reported behavior. Changing this is potentially a breaking change, but might be worth it to be aligned with other platforms.
Thanks for acknowledging the problem.
While there is a chance that this is a breaking change, currently, people must be writing hack code to work around this. So, it will be worth fixing now so that developers in future don't have to pile hack code on top of hack code to avoid this issue.
Should be fixed in 2.4.1.-pre1. Thank you!
You guys are killing it. Nice work.