Ejemplo n.º 1
0
        protected override void OnKeyDown(KeyRoutedEventArgs args)
        {
            // We don't perform any action in OnKeyDown because we wait for the key to be
            // released before performing a Toggle().  However, if we don't handle OnKeyDown,
            // it bubbles up to the parent ScrollViewer and may cause scrolling, which is
            // undesirable.  Therefore, we check to see if we will handle OnKeyUp for this key
            // press, and if so, we set Handled=true for OnKeyDown to stop bubbling this event.
            base.OnKeyDown(args);

            var isHandled = args.Handled;

            if (isHandled || _isDragging)
            {
                return;
            }

            var key = args.OriginalKey;

            isHandled = KeyProcess.KeyDown(key, this);

            args.Handled    = isHandled;
            _handledKeyDown = isHandled;
        }
Ejemplo n.º 2
0
 private protected virtual bool OnKeyDownInternal(VirtualKey key)
 {
     KeyProcess.KeyDown(key, out var handled, _keyboardNavigationAcceptsReturn, this);
     return(handled);
 }