Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] DialogService messes up with binded Picker #1948

Closed
chrswgnr opened this issue Nov 12, 2019 · 2 comments · Fixed by #1952
Closed

[Bug] DialogService messes up with binded Picker #1948

chrswgnr opened this issue Nov 12, 2019 · 2 comments · Fixed by #1952
Assignees

Comments

@chrswgnr
Copy link

Description

I have the following scenario when using Prism.Forms: a Page with a Picker that binds the ItemSource and SelectedItem properties. An action calls the IDialogService.ShowDialog() its callback does absolutely nothing with the binded properties. But when it get's called the setter of the SelectedItem property is called with null as value and tho clears its previous value.

Steps to Reproduce

  1. Page with Picker and Binded ItemSource and SelectedItem property
  2. That PageViewModel calls ShowDialog on the injected IDialogService

Expected Behavior

Dialog is shown

Actual Behavior

Dialog is shown, but also the binded SelectedItem property of the picker is set to null.

Basic Information

  • Version with issue: v7.2.0.1367
  • Last known good version: -
  • Xamarin.Forms version: v4.1.0.673156
  • IDE: VisualStudio 15.9.15

Additional Information

I traced it back to DialogService Line 308 that changes the content of the current page temporary. This seems to update serval Bindings and clear the ItemSource of the picker, due to that the SelectedItem also gets cleared.

Reproduction Link

Here is an sample that demonstrates the issue:
PickerDialogIssue.zip

@chrswgnr chrswgnr changed the title [Bug] DialogServices messes up with Binded Picker [Bug] DialogService messes up with binded Picker Nov 12, 2019
@AmrAlSayed0
Copy link
Contributor

I am guessing this has to do with this issue xamarin/Xamarin.Forms#7340, probably adding the page's content to the AbsoluteLayout's children sets/propagates the binding context of the layout down the tree? Maybe set the binding context of the AbsoluteLayout to the binding context of the Page before adding it?

@lock
Copy link

lock bot commented Jan 28, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants