Occurs when one or more Note or KmlNode MapItems are clicked in the application.

Namespace:  ESRI.ArcGISExplorer.Mapping

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public event EventHandler<MapItemMouseEventArgs> MapItemClicked
Visual Basic (Declaration)
Public Event MapItemClicked As EventHandler(Of MapItemMouseEventArgs)

Remarks

A MapItem is a type of map content represented by a number of classes, all of which inherit from the MapItem class, however this event only fires for Notes and KmlNodes. The MapItemMouseEventArgs argument provide access to the items which were clicked, and other properties of the click event. Multiple items can be returned if they are coincident at the location of the click.

As this event applies to a subset of the available MapItem types, it cannot be used to perform a query to identify features in other layer types at the clicked location. For more information on performing a spatial query on a FeatureLayer see Scenario 3 in How to Search a Table.

Note that the access to multiple items is supported from ArcGIS Explorer 2.0.0.1500 onwards.

Examples

The code below demonstrates how to wire up the MapItemClicked event in an Extension Add-in.
CopyC#
using System;
using ESRI.ArcGISExplorer;
using ESRI.ArcGISExplorer.Application;
using ESRI.ArcGISExplorer.Mapping;

namespace MapItemClicked
{
  public class MapItemClicked : ESRI.ArcGISExplorer.Application.Extension
  {
    ESRI.ArcGISExplorer.Mapping.MapDisplay _disp;

    public override void OnStartup()
    {
      //Return the MapDisplay
      _disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
      //Register to listen the the MapItemClicked event
      _disp.MapItemClicked += new EventHandler<MapItemMouseEventArgs>(MapItemClickedHandler);
    }

    void MapItemClickedHandler(object sender, MapItemMouseEventArgs e)
    {
      //Iterate over all the clicked MapItem objects (can only be Note or KmlLayer)
      foreach (MapItem item in e.MapItems)
      {
        //Print the name of each MapItem
        System.Diagnostics.Debug.Print(item.Name);
      }
    }

    public override void OnShutdown()
    {
      //Unregister the event listener when the application exits
      _disp.MapItemClicked -= new EventHandler<MapItemMouseEventArgs>(MapItemClickedHandler);
    }
  }
}
CopyVB.NET
Imports System
Imports ESRI.ArcGISExplorer
Imports ESRI.ArcGISExplorer.Application
Imports ESRI.ArcGISExplorer.Mapping

Public Class MapItemClicked
  Inherits ESRI.ArcGISExplorer.Application.Extension
  Private _disp As ESRI.ArcGISExplorer.Mapping.MapDisplay

  Public Overloads Overrides Sub OnStartup()
    'Return the MapDisplay 
    _disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
    'Register to listen the the MapItemClicked event 
    AddHandler _disp.MapItemClicked, AddressOf MapItemClickedHandler
  End Sub

  Private Sub MapItemClickedHandler(ByVal sender As Object, ByVal e As MapItemMouseEventArgs)
    'Iterate over all the clicked MapItem objects (can only be Note or KmlLayer) 
    For Each item As MapItem In e.MapItems
      'Print the name of each MapItem 
      System.Diagnostics.Debug.Print(item.Name)
    Next
  End Sub

  Public Overloads Overrides Sub OnShutdown()
    'Unregister the event listener when the application exits 
    RemoveHandler _disp.MapItemClicked, AddressOf MapItemClickedHandler
  End Sub
End Class

See Also