First of all, I would rather consider the alternative approach inline with the design of the OS: taskbar notifications, which have been designed exactly for this purpose. Please see these CodeProject articles:
WPF NotifyIcon[
^],
WPF Taskbar Notifier - A WPF Taskbar Notification Window[
^].
The "usual" way of showing some notification window can also be related to the taskbar if you want to show it regardless the current Z-order position of your application. First of all, pay attention: system-modal dialogs are not supported by modern versions of Windows anymore. So, you need to make the notification visible in some other ways.
You can place any window where you want, but you need to determine current screen size to put it in the corner,
System.Windows.SystemParameters.PrimaryScreenHeight
and
System.Windows.SystemParameters.PrimaryScreenWidth
.
First of all, you can bring some application window on top. You can activate the window:
https://msdn.microsoft.com/en-us/library/system.windows.window.activate%28v=vs.110%29.aspx[
^],
https://msdn.microsoft.com/en-us/library/system.windows.window.showactivated%28v=vs.110%29.aspx[
^].
Note that the MSDN page in
Window.Activate
tells you: "Attempts to bring the window to the foreground and activates it". You can get a notification by blinking the window in the task bar. I would advise to take care of ownership relationships between window before you show the notification window: makes it owned by the main window, so both would be shown on top. Please see:
https://msdn.microsoft.com/en-us/library/system.windows.window.owner(v=vs.110).aspx[
^].
Also, it's better to make sure that main window is shown in taskbar, but not the notification window. That's right, this way, not to opposite. This way, the main window will represent other windows in task bar. However, the notification window can be modal, showing with
ShowDialog
. Please see:
https://msdn.microsoft.com/en-us/library/system.windows.window.showdialog(v=vs.110).aspx[
^],
https://msdn.microsoft.com/en-us/library/system.windows.window.showintaskbar(v=vs.110).aspx[
^].
Another way is showing a window with "almost-on-top" style, which has one drawback: it will be guaranteed to be on top only if there are no other topmost windows in the system. Here is how:
https://msdn.microsoft.com/en-us/library/system.windows.window.topmost%28v=vs.110%29.aspx[
^].
I would not recommend this way though.
I would recommend the first method, the one based on
NotifyIcon
.
—SA