コード例 #1
0
 public static IObservable <KeyboardFocusChangedEventArgs> PreviewGotKeyboardFocus(this DependencyObject that)
 {
     return(Observable.FromEvent <KeyboardFocusChangedEventArgs>(
                on => Keyboard.AddPreviewGotKeyboardFocusHandler(that, (o, e) => on(e)),
                on => Keyboard.RemovePreviewGotKeyboardFocusHandler(that, (o, e) => on(e))
                ));
 }
コード例 #2
0
        }         // proc LoadInternAsync

        /// <summary>Control is created.</summary>
        protected virtual void OnControlCreated()
        {
            CallMemberDirect(nameof(OnControlCreated), Array.Empty <object>(), rawGet: true, ignoreNilFunction: true);

            Mouse.AddPreviewMouseDownHandler(Control, Control_MouseDownHandler);
            Mouse.AddPreviewMouseDownOutsideCapturedElementHandler(Control, Control_MouseDownHandler);
            Keyboard.AddPreviewGotKeyboardFocusHandler(Control, Control_GotKeyboardFocusHandler);
            Keyboard.AddPreviewLostKeyboardFocusHandler(Control, Control_LostKeyboardFocusHandler);
            Keyboard.AddPreviewKeyUpHandler(Control, Control_KeyUpHandler);
        }         // proc OnControlCreated
コード例 #3
0
 private void RegisterFocusEvents(bool register)
 {
     if (register && !eventWired)
     {
         Keyboard.AddPreviewGotKeyboardFocusHandler(this, new KeyboardFocusChangedEventHandler(TooltipTracker));
         eventWired = true;
     }
     else if (!register && eventWired)
     {
         Keyboard.RemoveGotKeyboardFocusHandler(this, new KeyboardFocusChangedEventHandler(TooltipTracker));
         eventWired = false;
     }
 }