1

I have a combo box in my application and when the drop down is open I would like the user to be able to type a letter and have the drop down skip to that selection. Currently it doesn't skip to the selection. I looked up couple of stackoverflow questions and applied the changes mentioned by them

IsTextSearchEnabled="True" TextSearch.TextPath="{Binding Name}"

WPF ComboBox using shortcut keys for selecting items

How to select item by typing a keyboard letter key in WPF combobox?

<ComboBox x:Name="serviceSelection" Grid.Row="0" Grid.Column="1"
                                          IsTextSearchEnabled="True"
                                         TextSearch.TextPath="{Binding Name}"
                                          VerticalAlignment="Top"
                                          Height="25"
                                          HorizontalAlignment="Right"
                                          Width="210"
                                          ItemsSource="{Binding ServiceRootNodes}"
                                          SelectionChanged="ServiceSelection_SelectionChanged"
                                          SelectedIndex="0">
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>                                               
                                            <TextBlock Text="{Binding Name}" />
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                </ComboBox>

Can someone provide me suggestions/feedback on what am i doing wrong ? Also in which cases does comboxBox letter search doesn't work?

Community
  • 1
  • 1
StackOverflowVeryHelpful
  • 2,347
  • 8
  • 34
  • 46

2 Answers2

1

Try giving the property name instead of binding

TextSearch.TextPath="Name"

Subhas S
  • 11
  • 1
  • This appears to be a solution. If you take a look in the comments to original post, you will notice the author himself came to the same solution. – Hexfire Dec 28 '17 at 06:40
0

This is what can help you get what you are looking for. http://social.msdn.microsoft.com/Forums/en-US/be860e67-c314-4a14-9e01-3bf948429ec0/combobox-first-letter-search

Gaurav Deochakke
  • 2,265
  • 2
  • 21
  • 26