views:

537

answers:

1

I've got this situation. (.net 3.5)

A Winform application that with OleAutomation and Office Interop create an excel, a toolbar and handlers for buttons in the toolbar.

Now we've got some functionality that shows the user modal windows (winform 2.0) with the method:

form.ShowDialog(new ExcelHwndWrapper(objExcelApplication.HWND))

And the "owner" of the modal form is set to the "excel" window.

Now I would like to create some WPF Window instead of Winforms due to layout requirements for new functionalities.

Is there any way to Show a WPF ModalDialog "over" excel Window ?

I found something for showing a WPF ModalDialog "over" a winform, but nothing over excel.

Thanks.

+1  A: 

When using VSTO and Office 2007, I've had trouble using WPF Windows as modal dialogues. What I found that worked much better was creating a Winforms Form and putting an ElementHost control inside it, then putting my WPF content inside that.

When I used WPF Windows without the Winforms wrapper I ran into trouble with properly capturing keyboard input, among other things.

As long as you make the ElementHost stretch to fill the entire dialogue it'll look like you have a WPF Window.

Sean Kermes