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

**URL:** <https://mapwindow.discourse.group/t/use-latest-version-of-ocx-v-5-2-in-a-wpf-app/646>\
**Category:** Uncategorized\
**Created:** [July 15, 2020, 12:39am UTC](https://mapwindow.discourse.group/t/use-latest-version-of-ocx-v-5-2-in-a-wpf-app/646 "2020-07-15T00:39:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaffyM](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@RaffyM](https://mapwindow.discourse.group/u/RaffyM)\
**Post date:** [July 15, 2020, 12:39am UTC](https://mapwindow.discourse.group/t/use-latest-version-of-ocx-v-5-2-in-a-wpf-app/646/1 "2020-07-15T00:39:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mathijs.Dumon](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Mathijs.Dumon](https://mapwindow.discourse.group/u/Mathijs.Dumon)\
**Post date:** [July 15, 2020, 9:52am UTC](https://mapwindow.discourse.group/t/use-latest-version-of-ocx-v-5-2-in-a-wpf-app/646/2 "2020-07-15T09:52:12Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![RaffyM](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@RaffyM](https://mapwindow.discourse.group/u/RaffyM)\
**Post date:** [July 15, 2020, 10:28am UTC](https://mapwindow.discourse.group/t/use-latest-version-of-ocx-v-5-2-in-a-wpf-app/646/3 "2020-07-15T10:28:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 5, 2022, 3:09pm UTC](https://mapwindow.discourse.group/t/use-latest-version-of-ocx-v-5-2-in-a-wpf-app/646/4 "2022-01-05T15:09:05Z")

</div>


