Pacman
Pacman

Reputation: 2245

IWin32Window in 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 ?

Upvotes: 10

Views: 3213

Answers (2)

Simon Mourier
Simon Mourier

Reputation: 139256

I think you need to use a WindowInteropHelper, like shown here: IWin32Window Owner For WPF Window

Upvotes: 0

Reed Copsey
Reed Copsey

Reputation: 564851

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

Upvotes: 8

Related Questions