Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: DataBinding a ListBox where each item is a Tab Stop

Tags:

c#

.net-3.5

wpf

I just built a WPF form that contains a ListBox. The ListBox has 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

like image 474
bugfixr Avatar asked Oct 20 '09 22:10

bugfixr


1 Answers

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" />
like image 135
Alun Harford Avatar answered Nov 09 '22 00:11

Alun Harford