Esempio n. 1
0
 private static void HandleIsAccessKeyScopePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (e.NewValue.Equals(true))
     {
         AccessKeyManager.AddAccessKeyPressedHandler(d, HandleScopedElementAccessKeyPressed);
     }
     else
     {
         AccessKeyManager.RemoveAccessKeyPressedHandler(d, HandleScopedElementAccessKeyPressed);
     }
 }
Esempio n. 2
0
 /// <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);
     }
 }
Esempio n. 3
0
 private static void OnIsAccessKeyScopeChanged(FrameworkElement element, bool oldValue, bool newValue)
 {
     if (newValue)
     {
         AccessKeyManager.AddAccessKeyPressedHandler(element, HandleScopedElementAccessKeyPressed);
     }
     else
     {
         AccessKeyManager.RemoveAccessKeyPressedHandler(element, HandleScopedElementAccessKeyPressed);
     }
 }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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);
            }
        }