Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Set Keyboard focus on NumericTextBoxDouble in WPF

Solved!
Go to solution

I'm trying to give a NumericTextBoxDouble control keyboard focus programmatically.  I tried NumericTextBoxDouble.Focus() and Keyboard.Focus(NumericTextBoxDouble) and neither of them worked.  Any thoughts?

0 Kudos
Message 1 of 3
(2,210 Views)
Solution
Accepted by topic author Bsea

Using Focus does give keyboard focus to the numeric control itself (for example, if you use the up or down arrow keys, the value will change).

 

However, setting focus to the control does not shift focus to the input area within the control. To do that, use the MoveFocus method:

 

numeric.MoveFocus( new TraversalRequest( FocusNavigationDirection.Next ) );

 

 

 

 

~ Paul H
0 Kudos
Message 2 of 3
(2,196 Views)

Works like a charm! Thanks for the help!

0 Kudos
Message 3 of 3
(2,157 Views)