✅ In a WPF application, how do you keep a modal window above all other windows for that app?

I only want that window on top of other windows for that application, not on top of everything.
9 Replies
bighugemassive3
there's a Topmost property in the Window class, set that to true not sure about the order of other topmost windows though, afaik what windows does internally store an order index, so maybe setting topmost to false then back to true will re-order it to the very top
Will Pittenger
Will PittengerOP2y ago
Uh, wouldn't that be on top of more than just my app? I just want to keep it in front of my main window.
bighugemassive3
oh i misread the message it seems like it is possible in windows but you'd have to do some unsafe things using window handles
Will Pittenger
Will PittengerOP2y ago
As is, when I move the focus to another app and then back to the main window, the dialog is hidden. Ugh.
bighugemassive3
the user32 SetWindowPos takes the hWnd, hWndInsertAfter, X, Y, etc.
bighugemassive3
Stack Overflow
How to make a WPF window be on top of all other windows of my app (...
I want my window to be on top of all other windows in my application only. If I set the TopMost property of a window, it becomes on top of all windows of all applications and I don't want that.
bighugemassive3
apparently if you set the window's Owner property then it might do what you want
Will Pittenger
Will PittengerOP2y ago
Oh. That explains that. Been too long.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?