Currently I have a WPF project with a custom UserControl. This control contains a grid which houses multiple form type elements (checkboxes, textboxes, comboboxes, etc.). The control is designed to look and operate as a form, however it's being placed inside a drag canvas, which is why it needs to be a UserControl and not a window.
The issue is the tab navigation between elements needs to be restricted to this control, so when I hit the "Tab" key on the last element in the control, the keyboard focuses the first element in the control. Currently it goes outside the control to the next tabbable element within the application.
Aside from capturing the key events manually, is there another way to restrict the tab navigation to a single WPF UserControl?
Try this on your user control:
KeyboardNavigation.TabNavigation="Cycle"
This will ensure when the last element in the user control is reached, the next tab press will cycle back to the beginning. See the MSDN for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With