I have a very simple example: WPF form application with single form which contains a dictionary with data:
Dim dict As New Collections.Generic.Dictionary(Of String, String)
Private Sub MainWindow_Loaded() Handles Me.Loaded
dict.Add("One", "1")
dict.Add("Two", "2")
dict.Add("Three", "3")
lst1.ItemsSource = dict
End Sub
On form I have a ListBox (named "lst1"), which uses "dict" as items source:
<ListBox x:Name="lst1">
<ListBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding Value}"
TextSearch.Text="{Binding Path=Key, Mode=OneWay}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Also I have one non-bound ListBox, prefilled with values manually:
<ListBox>
<Label TextSearch.Text="One" Content="1" />
<Label TextSearch.Text="Two" Content="2" />
<Label TextSearch.Text="Three" Content="3" />
</ListBox>
So when I launch app, it looks like this:
THE QUESTION:
If I try to navigate items with keyboard by typing "one", "two" or "three", I succeed only in non-bound list box. Bound list box fails.
Some remarks: 1.) If I press "[" while in bound list box, focus changes from item to item in cyclic manner: it goes from 1 to 2, from 2 to 3, from 3 to 1, from 1 again to 2 etc. 2.) I have checked app with Snoop. One difference I found between bound and non-bound list boxes. Both list boxes have TextSearch.Text property set on Label controls (inside ItemsPresenter). But for non-bound case: "value source" of TextSearch.Text property is "Local". For bound case: "value source" is "ParentTemplate".
P.S. (and N.B.) I know that I can use TextSearch.TextPath on the list box, but this is not what I need :) Also, setting TextSearch.Text property for ListViewItem (by using Style) does not help.