Use latest version of ocx (v 5.2) in a WPF app

Hello,

I tried to use the map control ocx in a wpf application using Visual Studio 2019. After adding a reference to MapWinGIS 5.2.2, I then proceeded to add the control to the toolbox. I got this message saying “The following controls were successfully added to the toolbox but are not enabled in the active designer”. And I googled what this meant. One result from the MSDN said that it is possible that the component is not compatible with the current designer - although the component in question was for a MaskedTextBox.

Could the same reason be also true that the map control is not compatible with WPF? If this is true then I guess I will have to go back to using WinForms then.

Thanks to the community.
Raffy

Hey Raffy,

I have not tried this myself - but there is an MSDN page about this topic:
https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/walkthrough-hosting-an-activex-control-in-wpf#hosting-the-activex-control-on-a-wpf-page

can you try the steps there and see if this resolves your issue?

edit: I don’t think you’ll be able to add the control through the designer, but you should be able to add it from code-behind as is explained in the MSDN page

Feeling sheepish here. I was going back and forth on this page before I posted this and I completely missed out that you are suppose to make a user control.

So there, you solved the problem. Thanks.