views:

344

answers:

1

Hi,

In wpf Textbox has TabIndex property to set the tab order, this is working fine when the controls are in the same context, In my case i have a listbox whose itemstyle has a text box and the style is assigned dynamically based on trigger. now how can i do the tabindexing so that when i tab index moves from textbox in first listboxitem to the textbox or combobox or button in the next listboxitem and as to the further listboxitems.

Thanks

Arvind

A: 

You need to specify the TabNavigation attached property so that WPF knows what to do when the user presses tab and there are no more controls in the current scope to tab to:

<ListBox>
    <ListBox.ItemContainerStyle>
        <Style TargetType="ListBoxItem">
            <Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
        </Style>
    </ListBox.ItemContainerStyle>
</ListBox>

Above I specify that when there are no more items in the ListBoxItem on which to focus, pressing tab should continue to the next logical focus container (ie. the next ListBoxItem).

HTH, Kent

Kent Boogaart
This still does not tab to the next listboxitem textbox. focus is lost once tabed out from first textbox.