#640 – Set the TabIndex Property to Change Tab Order

By default, the sequence of controls that get keyboard focus when the user clicks on the Tab key is based on their order in the logical tree.

If you want to change this Tab order, however, you can set the TabIndex property of each control.  The TabIndex value should start a 0 for the first control that should receive focus and then proceed sequentially, i.e. 1, 2, 3, etc.  Controls with a lower TabIndex will therefore get focus before controls with a higher TabIndex.

    <StackPanel Orientation="Vertical">
        <Button Content="Harpo" TabIndex="1" HorizontalAlignment="Center" Margin="5"/>
        <Button Content="Chico" TabIndex="0" HorizontalAlignment="Center" Margin="5"/>
        <Button Content="Groucho" TabIndex="2" HorizontalAlignment="Center" Margin="5"/>


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: