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

OnShow Method
Called when the visibility of the DockPane changes.
Syntax
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
private SubscriptionToken _eventToken = null;
// Called when the visibility of the DockPane changes.
protected override void OnShow(bool isVisible)
{
  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;
  }
}
//Event handler when the MapSelection event is triggered.
private void OnMapSelectionChangedEvent(MapSelectionChangedEventArgs obj)
{
  MessageBox.Show("Selection has changed");
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also