ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Presentations Namespace / PresentationPage Class / FindElement Method
The element name.
Example

In This Topic
    FindElement Method (PresentationPage)
    In This Topic
    Finds the element specified by name in the presentation page.
    Syntax
    Public Function FindElement( _
       ByVal elementName As String _
    ) As Element
    public Element FindElement( 
       string elementName
    )

    Parameters

    elementName
    The element name.

    Return Value

    The element
    Example
    Element selection and navigation
    {
      //Note: Must be on QueuedTask
      // Find specific elements by name
      var ge_rect = page.FindElement("Rectangle") as GraphicElement;
      var elements = new List<string>();
      elements.Add("Text");
      elements.Add("Polygon");
      var elems = page.FindElements(elements);
    
      //Get elements retaining hierarchy
      var top_level_elems = page.GetElements();
    
      //Flatten hierarchy
      var all_elems = page.GetFlattenedElements();
    
      //Use LINQ with any of the collections
      //Retrieve just those elements that are Visible
      var some_elems = all_elems.Where(ge => ge.IsVisible).ToList();
    }
    Element selection manipulation
    {
      //Note: Must be on QueuedTask
      //Select/unselect some elements...
      var elems = activePage.GetFlattenedElements();
      //select any element not a group element
      activePage.SelectElements(elems.Where(e => !e.Name.StartsWith("Group")));
      activePage.UnSelectElements(elems.Where(e => !e.Name.StartsWith("Group")));
    
      //Select/unselect all visible, graphic elements
      var ge_elems = elems.Where(ge => ge.IsVisible).ToList();
      activePage.SelectElements(ge_elems);
      activePage.UnSelectElements(ge_elems);
    
      //Select/unselect a specific element
      var na = activePage.FindElement("My Text Element");
      activePage.SelectElement(na);
      activePage.UnSelectElement(na);
    
      //Select everything
      activePage.SelectElements(elems);
    
      //enumerate the selected elements
      foreach (var sel_elem in activePage.GetSelectedElements())
      {
        //TODO
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.5 or higher.
    See Also