private static void HandleIsAccessKeyScopePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue.Equals(true)) { AccessKeyManager.AddAccessKeyPressedHandler(d, HandleScopedElementAccessKeyPressed); } else { AccessKeyManager.RemoveAccessKeyPressedHandler(d, HandleScopedElementAccessKeyPressed); } }
/// <summary> /// Called when the <see cref="P:DigitalRune.Window.AccessKeyScope.IsEnabled"/> property /// changed. /// </summary> /// <param name="dependencyObject">The dependency object.</param> /// <param name="eventArgs"> /// The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data. /// </param> private static void OnIsEnabledChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) { if ((bool)eventArgs.NewValue) { AccessKeyManager.AddAccessKeyPressedHandler(dependencyObject, OnAccessKeyPressed); } else { AccessKeyManager.RemoveAccessKeyPressedHandler(dependencyObject, OnAccessKeyPressed); } }
private static void OnIsAccessKeyScopeChanged(FrameworkElement element, bool oldValue, bool newValue) { if (newValue) { AccessKeyManager.AddAccessKeyPressedHandler(element, HandleScopedElementAccessKeyPressed); } else { AccessKeyManager.RemoveAccessKeyPressedHandler(element, HandleScopedElementAccessKeyPressed); } }
private void DisonnectFromPresentationSource() { if (_rootInputElement != null) { foreach (string registeredKey in _renameAccessKeys) { AccessKeyManager.Unregister(registeredKey, _rootInputElement); } AccessKeyManager.RemoveAccessKeyPressedHandler(_rootDependencyObject, OnAccessKeyPressed); } _presentationSource = null; _rootDependencyObject = null; _rootInputElement = null; }
private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d == null) { return; } if ((bool)e.NewValue) { AccessKeyManager.AddAccessKeyPressedHandler(d, HandleAccessKeyPressed); } else { AccessKeyManager.RemoveAccessKeyPressedHandler(d, HandleAccessKeyPressed); } }