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

In This Topic
    SetLockedAspectRatio Method (Element)
    In This Topic
    Sets the locked aspect ratio value of the element. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetLockedAspectRatio( 
       bool lockedAspectRatio
    )
    Public Sub SetLockedAspectRatio( _
       ByVal lockedAspectRatio As Boolean _
    ) 

    Parameters

    lockedAspectRatio
    Double
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run.
    This element requires its mapview to be active
    Remarks
    When set to true, this means if element width is set, then the element height will be automatically adjusted appropriately. The same is true if height were modified, then width would automatically be adjusted.
    Placement for an element contained in graphics layer requires the mapview be active.
    Example
    Element_GetSetLockedAspectRatio
    //Modify an element's aspect ratio. 
    
    //Perform on the worker thread
    await QueuedTask.Run(() =>
    {
      bool elmLocked = element.GetLockedAspectRatio();
      elmLocked = false;  //Turn off the locked state.
    
      element.SetLockedAspectRatio(elmLocked); //You don't have to get to set; a shortcut would be: element.SetLockedAspectRatio(false);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also