ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Bookmark Class / SetDefinition Method
The definition used to update the bookmark.
Example

In This Topic
    SetDefinition Method (Bookmark)
    In This Topic
    Updates the bookmark using a CIM definition of a bookmark. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public void SetDefinition( 
       CIMBookmark bookmark
    )
    Public Sub SetDefinition( _
       ByVal bookmark As CIMBookmark _
    ) 

    Parameters

    bookmark
    The definition used to update the bookmark.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Update Extent for a Bookmark
    public Task UpdateBookmarkExtentAsync(Bookmark bookmark, ArcGIS.Core.Geometry.Envelope envelope)
    {
      return QueuedTask.Run(() =>
      {
        //Get the bookmark's definition
        var bookmarkDef = bookmark.GetDefinition();
    
        //Modify the bookmark's location
        bookmarkDef.Location = envelope;
    
        //Clear the camera as it is no longer valid.
        bookmarkDef.Camera = null;
    
        //Set the bookmark definition
        bookmark.SetDefinition(bookmarkDef);
      });
    }
    Update Extent for a Bookmark
    public Task UpdateBookmarkExtentAsync(Bookmark bookmark, ArcGIS.Core.Geometry.Envelope envelope)
    {
      return QueuedTask.Run(() =>
      {
        //Get the bookmark's definition
        var bookmarkDef = bookmark.GetDefinition();
    
        //Modify the bookmark's location
        bookmarkDef.Location = envelope;
    
        //Clear the camera as it is no longer valid.
        bookmarkDef.Camera = null;
    
        //Set the bookmark definition
        bookmark.SetDefinition(bookmarkDef);
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also