1 ViewModel, 2 Views. Minimizing 1st view causes 2nd to minimize.

Topics: UI Architecture
Sep 1, 2013 at 4:31 AM
I am using the standard CM conventions to have two different views bound to one viewmodel. It seems to work great, except that I might have both views visible at the same time. When I do, if the 1st view that was created is minimized, the 2nd view is also minimized automatically. I would like for the 2nd view to stay up even if the 1st is minimized.

Is there some trickery I can do to make this (not) happen?

The viewmodel I am using inherits from Screen and is in charge of opening the 2nd view to itself. When a button is clicked, it simply calls windowManager.ShowWindow(this, "SecondView");
Sep 6, 2013 at 4:14 AM
Figured out a (the?) solution.

The WindowManager determines the owning Window of the new Window being shown and sets the Owner property on the new Window. According to MSDN (Window Lifetime) if the Owner is set for a Window, then the child window will close, maximize, minimize in concert with the parent window.

So after I call WindowManager.ShowWindow for my new Window I just call GetView and then set the Owner property to null. This allows me to minimize either window without affecting the other.