Example #1
0
        private void FlickerFocusToForceBindingCommit()
        {
            Control currentControl = Keyboard.FocusedElement as Control;

            if (currentControl != null)
            {
                // Force focus away from the current control to update its binding source.
                currentControl.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
                currentControl.Focus();
                // moving next is not enough, as the next item could be a menu item (in a different focus
                // scope) so also try the previous command.
                currentControl.MoveFocus(new TraversalRequest(FocusNavigationDirection.Previous));
                currentControl.Focus();
            }
        }
 internal void UnfocusControl(WControl control)
 {
     if (control == null || !control.IsEnabled)
     {
         return;
     }
     control.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
 }
Example #3
0
        /// <summary>
        /// Transfer the focus to the next focusable item
        /// </summary>
        private void GoNext()
        {
            System.Windows.Controls.Control element = Keyboard.FocusedElement as System.Windows.Controls.Control;

            if (element.TabIndex == 7)
            {
                Keyboard.Focus(tb2000);
            }
            else
            {
                element.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
            }
        }