ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Layouts.Events Namespace / LayoutViewEventHint Enumeration
Example Example

In This Topic
    LayoutViewEventHint Enumeration
    In This Topic
    Specifies the type of LayoutView events.
    Syntax
    Members
    MemberDescription
    ActivatedA Layout pane has been activated.
    ClosedA Layout pane has been closed.
    ClosingA Layout pane is closing. Set Cancel to true to prevent closing.
    DeactivatedA Layout pane has been deactivated.
    DrawingCompleteA Layout finished drawing.
    ExtentChangedA Layout's extent has changed.
    OpenedA new Layout pane has been opened.
    PauseDrawingChangedA Layout pause drawing changed.
    Example
    LayoutViewEvent_Activated_Deactivated
    //Report the event args when a the layout view has changed.
    
    //At 2.x - ArcGIS.Desktop.Layouts.Events.ActiveLayoutViewChangedEvent.Subscribe((args) =>
    //{
    //  System.Windows.MessageBox.Show("ActiveLayoutViewChangedEvent:" +
    //    Environment.NewLine +
    //    "   arg Layoutview: " + args.LayoutView.Layout.Name +
    //    Environment.NewLine +
    //    "   arg Type: " + args.Type.ToString());
    //});
    
    ArcGIS.Desktop.Layouts.Events.LayoutViewEvent.Subscribe((args) =>
    {
      //this is the view being activated 
      var layout = args.LayoutView?.Layout?.Name ?? "null";
    
      if (args.Hint == LayoutViewEventHint.Activated)
      {
        System.Diagnostics.Debug.WriteLine($"LayoutViewEventHint.Activated: {layout}");
      }
      else if (args.Hint == LayoutViewEventHint.Deactivated)
      {
        System.Diagnostics.Debug.WriteLine($"LayoutViewEventHint.Deactivated: {layout}");
      }
    });
    LayoutViewEvent_LayoutClosed
    //Report the event args when a layout is closed.
    
    //At 2.x - ArcGIS.Desktop.Layouts.Events.LayoutClosedEvent.Subscribe((args) =>
    //{
    //  System.Windows.MessageBox.Show("LayoutClosedEvent:" +
    //  Environment.NewLine +
    //  "   arg LayoutPane: " + args.LayoutPane.Caption);
    //});
    
    ArcGIS.Desktop.Layouts.Events.LayoutViewEvent.Subscribe((args) =>
    {
      var lv = args.LayoutView;
      var layoutName = lv?.Layout?.Name ?? "null";
      if (args.Hint == LayoutViewEventHint.Closed)
      {
        System.Diagnostics.Debug.WriteLine($"LayoutViewEventHint.Closed: {layoutName}");
      }
    });
    
    LayoutViewEvent_LayoutClosing
    //Report the event args when a layout is closing.
    
    //At 2.x - ArcGIS.Desktop.Layouts.Events.LayoutClosingEvent.Subscribe((args) =>
    //{
    //  System.Windows.MessageBox.Show("LayoutClosingEvent:" +
    //  Environment.NewLine +
    //  "   arg Layout: " + args.Layout.Name +
    //  Environment.NewLine +
    //  "   arg LayoutPane: " + args.LayoutPane.Caption);
    //});
    
    ArcGIS.Desktop.Layouts.Events.LayoutViewEvent.Subscribe((args) =>
    {
      var lv = args.LayoutView;
      var layoutName = lv?.Layout?.Name ?? "null";
      if (args.Hint == LayoutViewEventHint.Closing)
      {
        System.Diagnostics.Debug.WriteLine($"LayoutViewEventHint.Closing: {layoutName}");
      }
    });
    LayoutViewEvent_PauseDrawingChanged
    //Report the event args when a layout's paused state is changed.
    
    //At 2.x - ArcGIS.Desktop.Layouts.Events.LayoutPauseDrawingChangedEvent.Subscribe((args) =>
    //{
    //  System.Windows.MessageBox.Show("LayoutPauseDrawingChangedEvent:" +
    //    Environment.NewLine +
    //    "   arg Layoutview: " + args.LayoutView.Layout.Name +
    //    Environment.NewLine +
    //    "   arg Type: " + args.Paused.ToString());
    //});
    
    //At 3.x use LayoutViewEvent
    ArcGIS.Desktop.Layouts.Events.LayoutViewEvent.Subscribe((args) =>
    {
      var lv = args.LayoutView;
      var layout = args.LayoutView?.Layout;
    
      switch (args.Hint)
      {
        case LayoutViewEventHint.PauseDrawingChanged:
          System.Diagnostics.Debug.WriteLine($"LayoutViewEvent ElementEventHint: {args.Hint.ToString()}");
          break;
      }
    });
    
    LayoutViewEvent
    //Report the event args for the different types of layout view events.
    
    ArcGIS.Desktop.Layouts.Events.LayoutViewEvent.Subscribe((args) =>
    {
      var lv = args.LayoutView;
      var layout = args.LayoutView?.Layout;
    
      switch(args.Hint)
      {
        case LayoutViewEventHint.PauseDrawingChanged:
        case LayoutViewEventHint.DrawingComplete:
        case LayoutViewEventHint.ExtentChanged:
        case LayoutViewEventHint.Activated:
        case LayoutViewEventHint.Deactivated:
        case LayoutViewEventHint.Closed:
        case LayoutViewEventHint.Closing:
        case LayoutViewEventHint.Opened:
          System.Diagnostics.Debug.WriteLine($"LayoutViewEvent ElementEventHint: {args.Hint.ToString()}");
          break;
      }
    });
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             ArcGIS.Desktop.Layouts.Events.LayoutViewEventHint

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also