Parameters
- isVisible
- The DockPane's visibility.
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"); }
Target Platforms: Windows 11, Windows 10