.netwpftab-orderingkeyboard-navigation

Setting tab order in WPF


How do I set tab ordering in WPF? I have an ItemsControl with some items expanded and some collapsed and would like to skip the collapsed ones when I'm tabbing.

Any ideas?


Solution

  • You can skip elements in the tab sequence by setting KeyboardNavigation.IsTabStop on the element in XAML.

    KeyboardNavigation.IsTabStop="False"
    

    You can setup a trigger that would toggle this property based on the expanded state.