Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IWin32Window in WPF

Tags:

winforms

wpf

I have an excel AddIn which exposes IWin32Window as it's main UI. I want to show a WPF window that uses this as it's parent.

How do I go about doing that ?

like image 275
Pacman Avatar asked Apr 04 '11 19:04

Pacman


1 Answers

You can use WindowInteropHelper to parent the WPF window appropriately:

var helper = new WindowInteropHelper(theWpfWindow);
helper.Owner = win32Window.Handle;

theWpfWindow.Show(); // This is now parented appropriately
like image 194
Reed Copsey Avatar answered Oct 26 '22 19:10

Reed Copsey