Click here to Skip to main content
13,048,766 members (67,631 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 27 Nov 2011

Set Owner of a WPF Window to a Form

, 28 Nov 2011
Rate this:
Please Sign up or sign in to vote.
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

You may also be interested in...

Comments and Discussions

QuestionExactly what I was looking for! Pin
morgi_a30-Jan-15 4:53
membermorgi_a30-Jan-15 4: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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 Nov 2011
Article Copyright 2011 by Akos Orban
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid