Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Child wpf window above parent window

Tags:

wpf

I have WPF application with main window. I want to create child WPF window which always must be above ONLY parent window. If I set TopMost property for new window then window is above ALL nonTopMost windows on desktop. It's not what I want.

like image 740
Alexander Avatar asked Aug 03 '11 13:08

Alexander


2 Answers

Set the Owner property of the child window so that it refers to the parent window.

child.Owner = parent;
like image 139
Ferruccio Avatar answered Dec 10 '22 07:12

Ferruccio


Depending on the nature of the window, I often use a "Fake" window that is really just a layer in the parent along with a partailly transparent grey layer between that makes the parent look ghosted while the child is active. You can then keep the child window set to collapsed until it is needed.

like image 30
Mike B Avatar answered Dec 10 '22 08:12

Mike B