Click here to Skip to main content
15,124,353 members
Articles / Desktop Programming / Windows Forms
Posted 27 Nov 2011

Tagged as


4 bookmarked

Set Owner of a WPF Window to a Form

Rate me:
Please Sign up or sign in to vote.
5.00/5 (16 votes)
28 Nov 2011CPOL
Set Owner of a WPF Window to a Form
Use the following method to set the owner of a System.Windows.Window to a System.Windows.Forms.Form:
public static void setOwner(System.Windows.Forms.Form ownerForm, System.Windows.Window window)
            WindowInteropHelper helper = new WindowInteropHelper(window);
            helper.Owner = ownerForm.Handle;

It might be useful when you are developing an application where you are using WinForms and WPF windows together.

Note: The window will appear always in front of its owner, I use this to display tips, for example.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Akos Orban
Poland Poland
No Biography provided

Comments and Discussions

GeneralMy vote of 5 Pin
Tokinabo14-May-20 15:55
professionalTokinabo14-May-20 15:55 
Questionjust 2 lines !! Pin
Naman Sharma19-Jun-18 22:03
MemberNaman Sharma19-Jun-18 22:03 
QuestionExactly what I was looking for! Pin
morgi_a30-Jan-15 5:53
Membermorgi_a30-Jan-15 5:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.