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

Multiple DialogHost problem #621

Closed
thiago-rcarvalho opened this issue Feb 13, 2017 · 2 comments
Closed

Multiple DialogHost problem #621

thiago-rcarvalho opened this issue Feb 13, 2017 · 2 comments

Comments

@thiago-rcarvalho
Copy link

thiago-rcarvalho commented Feb 13, 2017

Hi!

I'm developing an application with multiple DialogHosts.
When I close a new view (which has a DialogHost) it takes some time to call the unload event from the DialogHost class and remove that view from de LoadedInstances.
And if I try to open that view imediatelly, it shows me this message:

Multiple viable DialogHosts. Specify a unique Identifier on each DialogHost, especially where multiple Windows are a concern.

If I remove the "if (targets.Count > 1)", my application seems to work normally.

Could you take a look?

Here is a repository with a simple example (and how to reproduce the error):
https://github.com/stealthcold/dialoghostexample.git

thanks

@ButchersBoy
Copy link
Collaborator

Exactly as the error says:

Multiple viable DialogHosts. Specify a unique Identifier on each DialogHost, especially where multiple Windows are a concern.

When you first open the dialog it works, because the second dialoghost hasnt loaded yet. Then, when you reopen there are two loaded dialoghosts, hence Multiple viable Dialoghosts.

It doesn't know which one to use.

You can do something like this:

<materialDesign:DialogHost Identifier="Main">
var result = await DialogHost.Show(view, "Main");

@velzher
Copy link

velzher commented Nov 12, 2018

Estas lineas pueden ayudarte:

var Popup = new usercontrolEjemplo() { };
DialogHostEx.ShowDialog(this, Popup);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants