How to add gmap programmatically in WPF?

Topics: Help, WPF
Sep 7, 2012 at 3:59 AM

I want to add gmap programmatically in WPF. I add the code below

GMapControl gmap = new GMapControl(); 

Grid grid = this.GetGrid();

Grid.SetColumn(gmap, 2);


But the grid shows nothing but a red cross in the middle. How can I make it work?


Sep 7, 2012 at 12:01 PM

by default control use dummy empty provider, use something ese:

GMapControl gmap = new GMapControl(); 
gmap.MapProvider = GMapProviders.OpenStreetMap;

gmap.MinZoom = 4;
gmap.MaxZoom = 17;
gmap.Zoom = gmap.MinZoom;


Sep 8, 2012 at 3:30 AM

Thank you very much.

But it seems that I can't drag and zoom in/out the map. Should I make it listen to mouse event or sth. like that?

Sep 8, 2012 at 11:38 AM

default DragButton is right