These are chat archives for punker76/MahApps.Metro.SimpleChildWindow

24th
Jul 2018
Todd Burnside
@toddburnside
Jul 24 2018 17:30

Hi all. I'm getting an InvalidOperationException when attempting to open a MahApps.Metro dialog while a SimpleChildWindow is open. This appears to be the same as documented in Issue #27 which was opened in Jan 2016 and fixed by a PR. The problem was that ChildWindowManager.ShowChildWindowAsync() was adding it's window directly to the MetroActiveDialogContainer. The PR changed this so that the window as added to the MetroInactiveDialogsContainer. However, later changes to ShowChildWindowsAsync() switched it back to preferentially adding it to the MetroActiveDialogContainer.

Is anyone else having this problem or have suggestions as to how to mitigate it? It seems to me that ShowChildWindowAsync() should be doing the same thing as the MahApps.Metro DialogManager.AddDialog does : if there is something in the active dialog container, move it to the inactive dialog container before putting the ChildWindow in the active dialog container. Of course this means that the ChildWindow ClosingFinished handler would need to deal with popping dialogs out of the inactive container if necessary, too.

Jan Karger
@punker76
Jul 24 2018 19:52
@toddburnside which versions do you use of both?
Todd Burnside
@toddburnside
Jul 24 2018 19:54
MahApps.Metro 1.6.5 and SimpleChildWindow 1.5.0.
Todd Burnside
@toddburnside
Jul 24 2018 20:01
I forked SimpleChildWindow and made the changes I mentioned above. It seems to be working, but the problem was sporadic so it's hard to be sure. The changes work for me, but I don't think they are necessarily a solution you want to merge in. For one thing, I removed a couple of public ShowChildWindowAsync methods that took the dialog container as a parameter. It also doesn't take the MetroWindow.IsAnyDialogOpen into account - but that is not a new issue.