Tab issues

2 posts, 0 answers
  1. David Harris
    David Harris avatar
    9 posts
    Member since:
    Apr 2007

    Posted 13 Feb 2009 Link to this post

    I'm trying to use the NumericUpDown but have encountered a frustrating issue regarding tabbing. By default when I tab through the screen my NumericUpDown controls get focus twice: first on the control as a whole, then on the internal textbox. I'd like to ignore the focus on the overall control and just go straight into the textbox, so I figured I could handle that in the GotFocus event. Unfortunately, the internal textBox control in a Non-Public member, and when I try to access it via reflection I receive a FieldAccessException. So I currently have no way to force focus into the internal textbox.

    Am I missing something obvious? If not, are there thoughts about allowing users to set the control to tab straight into the textbox area? Or, at the very least is there a way to access the textbox from my code so that I can force it manually (by setting IsTabStop to False for the NumericUpDown but IsTabStop to True for the internal textBox)?
  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 16 Feb 2009 Link to this post

    Hi David,

    I tested this with the 1217 & 1105 versions of the controls and I could not reproduce it. Then I set the IsTabStop property to true and the problem appeared. The IsTabStop property only removes the particular visual item (the control) from the Tab sequence, but not its children.

    When I set the IsTabStop property to false (its default value) I see the expected behavior. Currently, the focus will jump directly to the TextBox.

    Generally, if you want to get a named visual part of a ControlTemplate, you can use the FindName method on the first visual child of the control. I will only use this when there is definitely no other way to achieve something.

    This is the simple xaml that I used to test it:

    <StackPanel> 
        <input:RadNumericUpDown  /> 
        <input:RadNumericUpDown  /> 
        <input:RadNumericUpDown  /> 
        <input:RadNumericUpDown  /> 
    </StackPanel> 

    Please come back to us if I am missing something or the context you use the NumericUpDown in is different.

    Regards,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
Back to Top