Reputation: 2363
I have a window in a WPF project that is used in a couple different places. Depending on the use I would like to be able to show it modal (ShowDialog()) or non modal (Show()). When a particular button is clicked on the UI it should fire an event if it's non-modal but return a dialog result if it's modal.
My question; is there a way to determine within the window code how it's been shown? I know you get an exception if you try to set dialog result if it's non modal but I'd rather not try and catch an exception.
I can set a simple boolean property that I can set manually telling me which it is. Not difficult so I can do that if that's the only way, but it would be nice to not have to remember to set that value each time.
Upvotes: 0
Views: 19