ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / IElement Interface / GetAnchor Method
Example

In This Topic
    GetAnchor Method (IElement)
    In This Topic
    Gets the anchor position of the element. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Anchor GetAnchor()
    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, Windows 8.1

    See Also