ArcGIS Explorer Component Help |
SelectedItemsCollection..::.Item Property |
SelectedItemsCollection Class Example See Also |
Gets the MapItem at the specified index position in the collection.
Namespace:
ESRI.ArcGISExplorer.ApplicationAssembly: ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public MapItem this[ int index ] { get; } |
Visual Basic (Declaration) |
---|
Public ReadOnly Default Property Item ( _ index As Integer _ ) As MapItem |
Parameters
- index
- Type: System..::.Int32
The index position of the MapItem to return.
Field Value
A MapItem object representing an item of map content at the specified index position within the collection.Remarks
Each MapItem in the SelectedItemCollection can be accessed by index position within the collection. Note that the Contents window displays MapItems in a tree view, and the SelectedItemsCollection is a simple ordered collection, therefore the item returned may be found either at root level or as a descendant of other items within the tree.
This property can be used in conjunction with the Count property to iterate through each selected item by index position. Alternatively, SelectedItemsCollection is also enumerable.
Examples
The code below shows two different ways to enumerate through the items in the SelectedItemsCollection, by using the
implementation of IEnumerable, and also by using the Item indexed property and the Count property.
CopyC#
// Get the collection of selected items from the application. ESRI.ArcGISExplorer.Application.SelectedItemsCollection selItems = ESRI.ArcGISExplorer.Application.Application.SelectedItems; // 1 - Enumerate using IEnumerable implementation. foreach (MapItem itm in selItems) { System.Diagnostics.Debug.WriteLine(itm.Name); } // 2 - Enumerate using Item and Count properties. for (int i = 0; i < selItems.Count; i++) { System.Diagnostics.Debug.WriteLine(i.ToString() + ":" + selItems[i].Name); }
CopyVB.NET
' Get the collection of selected items from the application. Dim selItems As ESRI.ArcGISExplorer.Application.SelectedItemsCollection = ESRI.ArcGISExplorer.Application.Application.SelectedItems ' 1 - Enumerate using IEnumerable implementation. For Each itm As MapItem In selItems System.Diagnostics.Debug.WriteLine(itm.Name) Next itm ' 2 - Enumerate using Item and Count properties. For i As Integer = 0 To selItems.Count System.Diagnostics.Debug.WriteLine(i.ToString() & ":" & selItems(i).Name) Next i
See Also
SelectedItemsCollection..::.Item[([(Int32])])