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
760
Tab Access Key
posted

I am wondering if there is a way to assign shortcut keys to tabs. For instance Alt+1 to select/move to first tab and so on.

Help much appreciated.

Tahir

Parents
No Data
Reply
  • 54937
    Suggested Answer
    Offline posted

    TabItems will register mnemonics based on the header text when there is an underscore (assuming the ContentPresenter within the template has its RecognizesAccessKey set to true) but there is no built in support for arbitrary shortcuts. You could probably create your own command and then add KeyBindings to the InputBindings of the control or perhaps write an attached behavior that will hook the keydown of the target and set the SelectedIndex of the Selector (the xamTabControl in this case) to that value. Note these would only work when the control itself has keyboard focus or keyboard focus is within the control otherwise it would not receive key events.

Children
No Data