Closing only one Window

Topics: Actions & Coroutines, Bugs
Aug 31, 2014 at 12:32 PM
I have one ViewModel and 2 Views for that ViewModel - "View" and "Detail".
First View is for displaying grid for all items and second is for displaying details of selected item where user can change or add new item.
I display first view with ShowDialog. After that I call ShowDialog for second View and everything works great.

But, if I try to close View when on "Detail" (with TryClose on ViewModel) I get error "Cannot set Visibility to Visible or call Show, ShowDialog, Close, or WindowInteropHelper.EnsureHandle while a Window is closing."

If I first get "Detail" view with GetView("Detail") and call Close on it, "View" is also closed.
I've tried to subscribe to View's closing event and set e.Cancel=true. In that case, "View" stays open, but it's removed from Views dictionary and TryClose or GetView do nothing.

Is there any way to change this behavior.
If i call Close on explicit View it shouldn't close all views associated with that ViewModel.