Can I create a ActiveX Control from a WPF UserControl and use in a non CLI C++ application?
I have created a Windows Forms UserControl that can be exposed as an ActiveX Control. Now I am trying to do the same with a WPF UserControl. The Winforms UserControl base class I noticed is 开发者_Python百科ComVisible however the WPF UserControl class is not. Am I trying to do the impossible?
Is the only way to achieve this to write a WPF control and then embed it in a Winforms UserControl using ElementHost and then expose that Winforms UserControl as an ActiveX control?
Yes, I think ElementHost is the approach you will need to use if there is a chance of this working.
This is because WPF controls are inherently windowless with everything being rendered in retained mode via a DirectX surface which WPF maanges.
There are interfaces for "windowless" ActiveX controls but the COM interop provided by .NET does not map these onto WPF objects either.
精彩评论