Live Chat Icon For mobile
Live Chat Icon

How can I set the Owner property of the WPF window to the handle of our main form?

Platform: WPF| Category: Message Loops Between

We can do this by using WindowInteropHelper. This can be done with the following code snippets.

var wpfWindow = new MainWindow();
            WindowInteropHelper windowInteropHelper = new WindowInteropHelper(wpfWindow);
            windowInteropHelper.Owner = this.Handle;

Note: While using the previous code in the form, add the following WPF assemblies to show the WPF window.

  • PresentationCore
  • PresentationFramework
  • WindowsBase

Reference link:

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.