ContentControl in front of all Windows

731 views Asked by At

In our WPF app we have one Main Window and a bunch of buttons that open pop-up Edit/ReadOnly Windows. In the Main Window we also have a ContentControl that gives notifications in the bottom right corner.

What I want to achieve is to have these notifications pop-up in the very front of all Windows. I know I can use Panel.ZIndex to make it the front View-Element inside the (Main) Window itself, but I'd also want it on top of the pop-up Windows that might be in front of it.

Is there a way to achieve this? I know I could put this ContentControl with Notifications inside a seperate Window instead of the MainWindow itself, but then I'd had to remove the borders and bar of the Window, remove it from the Windows Taskbar at the bottom and a bunch of other stuff to make it look/act the same as it is right now, which I preferably avoid.

So, what is the best way to approach this and is it even possible without putting it in a seperate Window, and have that pop up in front of every other window every time a new Notifications comes up?

1

There are 1 answers

2
Sheridan On BEST ANSWER

Unfortunately, you don't have a choice to make as the only way to make your ContentControl appear on top of other Windows is to put it into its own Window and set its TopMost property to true. As it is, the Panel.ZIndex will only affect the Z index of the control within the MainWindow... you can't set it to be displayed above the level of the parent Window.

So in short, your solution is to add your ContentControl to a custom Window and make that appear on top.