Using the esriControls.ControlsSelectTool I select a text element that I have previously placed on the map. In code, how can I find this element on the map? I know I can iterate using the IGraphicsContainer but how can I tell that the element is the selected element?
1 Answer
Should have known another interface would be waiting (given that 'view' is an IActiveView):
IElement selectedElement = null;
IGraphicsContainerSelect graphicsContainerSelect =
view.FocusMap as IGraphicsContainerSelect;
if ( graphicsContainerSelect == null ) return selectedElement;
if ( graphicsContainerSelect.ElementSelectionCount == 0 ) return selectedElement;
IEnumElement enumElement = graphicsContainerSelect.SelectedElements;
selectedElement = enumElement.Next();
while ( selectedElement != null ) {
// whatever
selectedElement = enumElement.Next();
}