It is useful to add context menus with contextual information. In this example Marker Tags and MenuItem Tags are used to do that.

Sample Context Menu code for Windows FormsEdit

public Form1()
private ContextMenu markerMenu = new ContextMenu();
private MenuItem command1 = null;
private MenuItem command2 = null;
private void Method1(object sender, EventArgs e)
  MenuItem item = sender as MenuItem;
  // access item.Tag to get the marker Tag info 
private void Method2(object sender, EventArgs e)
private void Form1_Load(object sender, EventArgs e)
  // initialize the commands
  command1 = new MenuItem("Your command name 1", new EventHandler(Method1));
  command2 = new MenuItem("Your command name 2", new EventHandler(Method2));

  // Initialize map:
  gmap.MapProvider = GMap.NET.MapProviders.BingMapProvider.Instance;
  GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
  gmap.SetPositionByKeywords("Maputo, Mozambique");

  GMapOverlay markersOverlay = new GMapOverlay("markers");
  GMarkerGoogle marker = new GMarkerGoogle(new PointLatLng(-25.966688, 32.580528),;
  // retain some data with this marker
  marker.Tag = "I am a stock marker";


  gmap.OnMarkerClick += new MarkerClick(gMap_OnMarkerClick);

private void gMap_OnMarkerClick(GMapMarker item, MouseEventArgs e)
   object identityData = item.Tag;

   // load the menus with marker data.
   command1.Tag = identityData;
   command2.Tag = identityData;

   if (identityData != null && e.Button == System.Windows.Forms.MouseButtons.Right)
      markerMenu.Show(gmap, e.Location);

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.