0

I have started a new project using WPF and Catel and I want to be able to have multiple windows without ownership. I have been able to create an application with a standard window and which creates dialogs. I would like to find an example or tutorial on how to create a window and then close the current window.

Example:

Window1 -> Select Open Window2 Button -> Open Window2 -> Close Window1

Thanks

Frank H
  • 1
  • 2

2 Answers2

0

When you call Show on the UIVisualizer, it should show the window non-modal. After calling the UIVisualizer service, just call CloseViewModel on yourself and the current window should close.

Geert van Horrik
  • 5,689
  • 1
  • 18
  • 32
  • 1
    This doesn't seem to work. When calling the UIVisualizer.Show() isn't there an association to the first window? If I show the Second Window, it displays properly, but if I show it and call CloseViewModel the whole application closes. – Frank H May 23 '14 at 14:40
  • Then use the right value for Application.ShutDownMode: http://msdn.microsoft.com/en-us/library/system.windows.application.shutdownmode(v=vs.110).aspx – Geert van Horrik May 23 '14 at 19:48
0

It appears that the above answer is correct as long as you are not closing the startup window.

It appears that when you close the ViewModel that is targeted as your startup View\ViewModel when you close it, it closes the whole application.

My question now.. How can I prevent this from happening.

Frank H
  • 1
  • 2