Parameters
- isVisible
- The DockPane's visibility.
{
// 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");
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)