ArcGIS Explorer Component Help |
Application..::.ActiveMapDisplay Property |
Application Class Example See Also |
Gets the MapDisplay which is currently active in the application. There is currently only
one MapDisplay in the application.
Namespace:
ESRI.ArcGISExplorer.ApplicationAssembly: ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public static MapDisplay ActiveMapDisplay { get; } |
Visual Basic (Declaration) |
---|
Public Shared ReadOnly Property ActiveMapDisplay As MapDisplay |
Field Value
The active map display.Remarks
This static property allows you to get a reference to the MapDisplay from within the code of your add-in, as shown in the example code.
Note that you may have to fully-qualify the Application class if you have a reference to System.Windows.Forms as it may clash with the Application class in that namespace.
Examples
The code below shows how you can get a reference to the current MapDisplay and Map within
add-in code, by using the static ActiveMapDisplay member of the Application class. The path and
name of the current map is then reported. This code assumes you have a using/imports statement
for the ESRI.ArcGISExplorer.Mapping namespace. It also assumes that you may have a using/imports
statement for the System.Windows.Forms namespace, and therefore the Application class is fully
qualified in order to avoid conflicts.
CopyC#
MapDisplay currentDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; Map currentMap = currentDisplay.Map; System.Diagnostics.Debug.WriteLine("The map at " + currentDisplay.MapPath + " is called " + currentMap.Name);
CopyVB.NET
Dim currentDisplay As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay Dim currentMap As Map = currentDisplay.Map System.Diagnostics.Debug.WriteLine("The map at " & currentDisplay.MapPath & " is called " & currentMap.Name)