Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
605
Tab-Navigation in TemplateColumnLayout
posted

Hello

I'm using TemplateColumnLayout in XamGrid and define a StackPanel as DataTemplate. This StackPanel has 10 Textboxes for example. When the first TextBox is focused and Tab-Key is pressed, then the focus jumps directly to the next row in XamGrid.

How can I achieve, that the second TextBox get focused by pressing Tab-Key?

Sincerly

Kasar

Parents
No Data
Reply
  • 34830
    Offline posted

    Hello Kasar,

    The XamGrid internally checks for tab key presses, as it has built-in tab navigation logic that is getting hit after the tab navigation logic for the TextBox elements that exist in your TemplateColumnLayout. This is because the key press event is bubbling out from the TextBoxes to the XamGrid, and is being handled by the XamGrid.

    To prevent this from happening, I would recommend that you hook into the PreviewKeyDown event on your TextBox elements in your TemplateColumnLayout and manually focus the next logical one if the Tab key was pressed. You can check the key from the e.Key property, where e is the event arguments. You can then mark the PreviewKeyDown event as handled by setting e.Handled = true, and this will prevent the bubbled Key event on the XamGrid from firing.

    I have attached a sample project to demonstrate the above. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    XamGridTCLTabNavCase.zip
Children
No Data