I have a requirement that specifies that a notification tray application that uses WPF must (based on some conditions) pop-up a window that is globally modal. This should prevent the user from doing anything (even outside of the Tray application) until they have satisfied some other conditions at which time it will enable the close button and allow the user to close it.
How does one make such a window? I have the window displaying and it evaluates the conditions and whatnot, but it is only modal to the application (i.e. it only blocks execution and UI for the application it is running under.
I imagine I could create a borderless window and maybe disable the minimize functionality, but they would still be able to access the start menu. Any takers? What I am striving for functionality-wise is similar to the Windows UAC/Admin privilege request window.
This is not a duplicate of the question provided by the duplicate box at the top. That question pertains to Windows Forms and is not applicable to WPF. As it happens I received an answer that worked well for me, and it was not the answer to the question provided above. Not that it matters really, but I would like the duplicate tag taken off. I like to think that I research my questions pretty well before posting, and adding that tag implies that I do not.
This question is not a duplicate of the question that was linked int he Duplicate Question box. That question was answered with in a Windows Forms flavor, and I am using WPF, a completely different UI framework.
Use the Window.ShowDialog()
method. More info can be found here
See the second comment by sixlettervariables.
One solution could be to make a semi transparent WPF window that covers the entire screen (actually you should say: all screens) and show the modal window using Window.ShowDialog()
with the owner being that window. All you need to do then is prevent task switching (which is not an easy task), but maybe doing that is enough?
Something like UAC does - for example like in the answer to this?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With