Mapview from WPF to winForm

3264
2
07-29-2015 10:19 AM
Labels (1)
GabeSmith
New Contributor

Trying to use the Map View tool which is made for WPF in a WinForms project and I have the ElementHost set up and ready to take a UserControl but, when I try setting up the User control, it won't allow me to put the Map View Tool into the WPF User Control. It is just greyed out saying I can't use it which doesn't make sense to me. Anyone know why it won't let me put the Map View into the User Control? Any fixes? Thanks in advance!Capture.PNG

2 Replies
MattNicol
New Contributor III

I had a similar issue where I got an error message about an invalid invocation of the constructor for my WPF user control.

I got around this by adding an empty ElementHost to my WinForm and then adding the control through code:

        public Form1()
        {
            InitializeComponent();
            elementHost1.Child = new MyWPFUserControlLibrary.UserControl1();
        }
AndyWhitaker1
New Contributor III

Thanks @MattNicol.  This worked for me too.  Had to use the code behind instead of the designer to add the UserControl.

0 Kudos