ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Framework.Contracts Namespace / DockPane Class / OnShow Method
The DockPane's visibility.
Example

In This Topic
    OnShow Method
    In This Topic
    Called when the visibility of the DockPane changes.
    Syntax
    Protected Friend Overridable Sub OnShow( _
       ByVal isVisible As Boolean _
    ) 
    protected internal virtual void OnShow( 
       bool isVisible
    )

    Parameters

    isVisible
    The DockPane's visibility.
    Remarks
    This method is also called when the DockPane is auto hidden - collapsed into the non-client area.
    Example
    How to subscribe and unsubscribe to events when the dockpane is visible or hidden
    {
      // Override the OnShow method of a dockpane to subscribe and unsubscribe to events
      if (isVisible && _eventToken == null) // Subscribe to event when dockpane is visible
      {
        _eventToken = MapSelectionChangedEvent.Subscribe(OnMapSelectionChangedEvent);
      }
    
      if (!isVisible && _eventToken != null) // Unsubscribe as the dockpane closes.
      {
        MapSelectionChangedEvent.Unsubscribe(_eventToken);
        _eventToken = null;
      }
    
      void OnMapSelectionChangedEvent(MapSelectionChangedEventArgs obj)
      {
        MessageBox.Show("Selection has changed");
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also