How To Reopen Closed Windows
Oct 02, 2018 Go to This PC or anywhere in File Explorer. Press Ctrl + F1 to expand the options panel. Click on the View tab. At the right, click Options then select Change folder and search options. Go to View Tab. Under Advanced settings, scroll down and enable the option that reads Restore previous folder windows at logon.
I switch ShutdownMode
in my app to OnExplicitShutdown
so when I close window, my app still working and I try to reopen window like this:
But I've got following error: Set property '...ViewModelLocator.AutoWireViewModel' threw an exception.
and InnerException
is: 'AutoWireViewModel' property was already registered by 'ViewModelLocator'
Have you any idea how to fix this?
I use ViewModelLocator
from Microsoft.Prism
How To Reopen Windows On Mac
1 Answer
Unfortunately, you simply can't re-open a Window
after it has been closed. However, you can 'pretend' that you can and use a little deception... instead of closing the Window
in the first place, you could simply hide it, as it can be hidden and re-displayed any number of times:
You could improve this situation slightly perhaps, by attaching an event handler to the Window.Closing
Event. This particular event provides a way to cancel the Close
operation and so at this point, you could hide it instead:
You could alternatively put this functionality inside the Window
code behind using the Window.OnClosing
Method if you preferred.