Dispose when Transfert from a elementhost to another since the new version

Topics: Bugs
Nov 23, 2011 at 2:51 PM

Hi, I just upgrade to your last version, and since them when I transfert the map from a elementhost to another it seem it "dispose" the map so I get alot of null reference...


I reproduce it by using that:

namespace WindowsFormsApplication1
    public partial class Form1 : Form
        Map objMap = new Map();

        public Form1()

            objMap.MapProvider = GMapProviders.OpenStreetMap;

            elementHost1.Child = objMap;           

        private void button1_Click(object sender, EventArgs e)
            elementHost1.Child = null;
            elementHost2.Child = objMap;

Nov 23, 2011 at 3:16 PM

did you tried set null to child after setting the map?

Nov 23, 2011 at 3:21 PM

hmm, you mean on the elementHost2 ?

Nov 23, 2011 at 3:30 PM


Nov 23, 2011 at 3:32 PM

I don't have any error when I do that... but I don't have anymore a map :)

if I put the child to null that mean the elementHost2 don't have anything to show :)

Nov 23, 2011 at 3:35 PM

check http://greatmaps.codeplex.com/SourceControl/changeset/changes/c91a8459fa2b

and try this:

objMap.SuspendDispose = true;
elementHost1.Child = null;
elementHost2.Child = objMap;

Nov 23, 2011 at 3:49 PM

Hmm, it will not work because you put it on the windowsform version, since the elementHost is for host a WPF I'm using the WPF version of gmapcontrol :)

but if you can put it on the WPF, I think it will work

Nov 23, 2011 at 3:58 PM

you hosting wpf control in windows forms, i can only guess why ;}

anyway: it's done on both

Nov 23, 2011 at 4:54 PM

yup, working, thank :)


it's a long story but all my main application was build in winform and WPF is more smooth... but it take time to convert evyerthing in WPF :)