ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / Element Class / GetAnchor Method
Example

In This Topic
    GetAnchor Method (Element)
    In This Topic
    Gets the anchor position of the element. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Anchor GetAnchor()
    Public Function GetAnchor() As Anchor

    Return Value

    Returns an Anchor
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run.
    Example
    Element_GetSetAnchor
    //Change the element's anchor position
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
      Anchor elmAnchor = element.GetAnchor();
      elmAnchor = Anchor.CenterPoint;
    
      element.SetAnchor(elmAnchor); //You don't have to get to set; a shortcut would be: element.SetAnchor(Anchor.CenterPoint);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also