Open munkii opened 4 years ago
I'm struggling with this problem too. It hurts badly in my scenario because I have property bound two way with a converter on it and the ConvertBack method gets called with null values and crashes. I could workaround this but then my viewmodel would receive a bad value to persist so that's not an option. @rid00z this looks like a big bug to go unnoticed for so long, what are we missing here?
@nexxuno I do think it is a bug and it's good to hear i'm not the only one. I'd love to get some input from @rid00z but in the meantime I have updated the stackoverflow question with the solution we have gone with, https://stackoverflow.com/questions/60171744/freshmvvm-and-resetting-vm-before-popping-modal/61118083#61118083
When we call PopPageModel with animate=true the input controls on the View temporarily appear as zero.
For example if we bind a Entry to a double property
<Entry Text="{Binding TemperatureValue}"></Entry>
Then call
await this.CoreMethods.PopPageModel(newTemperature, true, true);
The text box resets to blank and that is visible for about 0.5 seconds before the View disappears. This is because the BindingContext gets set to Null prior to the View disappearing.
If I remove the binding in BindingContextChanged then the TextBox\Entry field continues to display data as I'd expect but I assume that isn't the expected approach.
I assume this is By Design. Is there a suggested approach to prevent the momentary flash of an unbound View?
UPDATE I have also asked this question StackOverflow, https://stackoverflow.com/questions/60171744/freshmvvm-and-resetting-vm-before-popping-modal