Search code examples
c#wpfexcelctp

WPF control directly inside Excel CTP


Currently I have a WinForm user control in the Excel CTP, which in turn hosts a WPF user control via an element host. Things are working well except for performance issues.

My question is - is it possible to load the WPF control directly without using a winform wrapper? i.e. expose the WPF user control or window as an active x control that I can pass directly to ICTPFactory::CreateCTP ?

Please note - I am not using VSTO. I am using Microsoft.Office.Core directly.


Solution

  • Well - this question has been out there for quite a while. So - I'm going to take a stab at answering it.

    Preferred Solution - DONT DO IT! WPF and Excel CTP just don't seem to mix. There are tons of issues right from UI refresh issues to focus and air space issues.

    Alternate Solution - Create an unmanaged activex control and use it as the CTP. Then use the HWND of the unmanaged activex control and the HwndSource class to parent WPF user controls on the unmanaged activex controls.

    Edit: I am going to leave this question open - in case someone can come up with a better solution.