ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / LayoutView Class / DeactivateMapFrame Method
Example

In This Topic
    DeactivateMapFrame Method
    In This Topic
    Deactivate the ActivatedMapFrame on the layout view. This method must be called on the UI thread.
    Syntax
    Public Sub DeactivateMapFrame() 
    public void DeactivateMapFrame()
    Exceptions
    ExceptionDescription
    Needs to run on the GUI thread
    Layout view must be the active view
    Remarks
    This method must be called on the UI thread (and not the MCT as is most commonly the case with most other synchronous API methods) or an System.InvalidOperationException will be thrown. The layout view you are deactivating the ActivatedMapFrame "on" must be the current active view or an System.InvalidOperationException will be thrown. The deactivated map frame will remain selected.
    Example
    Deactivate Map Frame
    {
      //Deactivate any activated map frame
      //Note: we are on the UI thread!
      layoutView.DeactivateMapFrame();//no-op if nothing activated
    
      //or - check if a  map frame is activated first...
      if (layoutView.ActivatedMapFrame != null)
        //Note: we are on the UI thread!
        layoutView.DeactivateMapFrame();
    }
    Requirements

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

    ArcGIS Pro version: 3.1 or higher.
    See Also