✅ 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
br4kejet
br4kejet15mo ago
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 PittengerOP15mo 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.
br4kejet
br4kejet15mo ago
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 PittengerOP15mo ago
As is, when I move the focus to another app and then back to the main window, the dialog is hidden. Ugh.
br4kejet
br4kejet15mo ago
the user32 SetWindowPos takes the hWnd, hWndInsertAfter, X, Y, etc.
br4kejet
br4kejet15mo ago
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.
br4kejet
br4kejet15mo ago
apparently if you set the window's Owner property then it might do what you want
Will Pittenger
Will PittengerOP15mo ago
Oh. That explains that. Been too long.
Accord
Accord15mo 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.
Want results from more Discord servers?
Add your server