public void RemoveGesture(object sender, RoutedEventArgs e) { if (sender is not FrameworkElement element || element.DataContext is not KeyValuePair <IInputGestureDescriptor, ObservableConcurrentCollection <IShortcutAction> > pair) { return; } var(gestureDescriptor, _) = pair; _manager.UnregisterGesture(gestureDescriptor); }