xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

Firing INPC on compiled bindings isn't updating the UI #1949

Closed davidbritch closed 6 years ago

davidbritch commented 6 years ago

Description

When using compiled bindings, firing INPC on properties that views on the UI bind to isn't resulting in an updated UI.

If you switch off compiled bindings, the page works as expected.

Steps to Reproduce

  1. Run the attached sample.
  2. On the CompiledBindings page enter some text in the Entry.

Expected Behavior

Entered text is stored in the CompiledBindingsViewModel.Text property, and INPC fires and updates the UI (entered text is displayed and the boolean value changes to true).

Actual Behavior

Entered text is stored in the CompiledBIndingsViewModel.Text property, INPC fires but the UI isn't updated despite binding to the correct view model properties.

Basic Information

Reproduction Link

CompiledBindings-INPCerror.zip

davidbritch commented 6 years ago

Here's a new sample with a converter for displaying the IsTextEntered property from the view model. I've also updated the sample to Forms 3.1.

Note that while the Text property is set as the user enters text in the Entry, the Label that also binds to the Text property isn't updated.

CompiledBindings-INPCerror.zip

StephaneDelcroix commented 6 years ago

I think I've nailed it. PropertyChangedEventHandlers are getting collected