简体   繁体   中英

Calling a control from 3rd Party DLL

I am using a control from a dll in my html page as

<object id="ATT"  width="100%" height="100%" 
        classid="CLSID:E20EC898-E4EE-4A20-A5A5-E10144FDC6BA" 
        codebase="AvtechMediaControl.cab#version=1,1,7,6" VIEWASTEXT>
</object>

But I want to access the same into my WPF application.

When I try to choose the DLL in the toolbox, i get the following error,

“The following controls were successfully added to the toolbox but are not enabled in the active designer”

I need a way to add it into my WPF project. I do not want to go with the webbrowser control.

ActiveX controls cannot be directly added to a WPF view, but then can be hosted inside of Windows Form control. And WPF can host WinForms controls. Microsoft has a walk through describing the process .

The short description of this is that you'll add a WindowsFormHost to you XAML view. The MSDN walk though shows this being done in the code behind, but the WindowsFormHost can be added in the XAML. Then you'll set the Child of the WindowsFormHost to the ActiveX control. This will have to be done in the code behind as there is no support for adding ActiveX controls in the XAML editor.

You also need to be aware of the behavior of a hosted control in WPF. No WPF content can overlap the hosted control. The hosted control will always draw over top of your WPF content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM