tags:

views:

255

answers:

1

I just built a WPF form that contains a ListBox. The ListBoxhas bound to it a list of TextBox controls. I need to make each TextBox control a TabStop so that a user can hit tab, type in a number, hit tab again and type in the next number, etc.

Problem is, the ListBox itself catches the tab then the next tab skips to following control after the ListBox.

Is there a way to make each TextBox inside the ListBox be tabbable (or perhaps another type of databound control that would work)?

Thanks

+1  A: 

Well we don't really have enough information to answer the question (this depends on what Templates and Style the ListBox is using) but you'll potentially need to play with the KeyboardNavigation.TabNavigation property to change how to cycle through the items and set IsTabStop on the ListBox to false.

Something like:

<ListBox DataSource={Binding} IsTabStop="False" KeyboardNavigation.TabNavigation="Cycle" />
Alun Harford
Thanks, worked great - now I just wish I could get each item to NOT cause a stop while allowing each textbox in the item to get it...
Chu
You need to set IsTabStop in the ItemContainerStyle
Alun Harford
Hm, not sure I follow - where is this style set? I'm using a DataTemplate (windows.resources) to tell my ListBox how to be databound. I see the ItemContainerStyle on the ListBox, but it doesn't seem to have an IsTabStop setting.
Chu