ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Layouts.Events Namespace / ElementEventArgs Class
Members Example

In This Topic
    ElementEventArgs Class
    In This Topic
    Provides data for the ElementEvent.
    Object Model
    ElementEventArgs ClassIElementContainer Interface
    Syntax
    Public Class ElementEventArgs 
       Inherits System.EventArgs
    public class ElementEventArgs : System.EventArgs 
    Example
    Subscribe to ElementSelectionChangedEvent
    {
      ArcGIS.Desktop.Layouts.Events.ElementEvent.Subscribe((args) =>
      {
        //check if the container is a graphics layer - could be a Layout (or even map view)
        if (args.Container is ArcGIS.Desktop.Mapping.GraphicsLayer graphicsLayer)
        {
          //get the total selection count for the container
          var count = args.Elements.Count();
          //Check count - could have been an unselect or clearselect
          if (count > 0)
          {
            //this is a selection or add to selection
            var elems = graphicsLayer.GetSelectedElements();
            //TODO process the selection...
          }
          else
          {
            //This is an unselect or clear selection
            //TODO process the unselect or clear select
          }
        }
      });
    }
    Inheritance Hierarchy

    System.Object
       System.EventArgs
          ArcGIS.Desktop.Layouts.Events.ElementEventArgs

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also