Reputation: 4114
Hello every one I have a problem with WPF ComboBox look at the code
<ComboBox x:Name="comboBox" Width="100" IsReadOnly="True" IsEditable="True" IsTextSearchEnabled="True">
<ComboBoxItem>dsf gd</ComboBoxItem>
<ComboBoxItem>asf gd</ComboBoxItem>
<ComboBoxItem>dsf gd</ComboBoxItem>
<ComboBoxItem>hsf gd</ComboBoxItem>
</ComboBox>
requirement is that the text in ComboBox can be selected, text search by key first letter shold work, and the comboBox should be editable I set the properties
IsReadOnly="True"
IsEditable="True"
but Text search doesn't work. Help me resolve this issue, please. Thanks in advance.
Upvotes: 7
Views: 28506
Reputation: 1146
Try IsTextSearchEnabled="True" TextSearch.TextPath="<PropertyName>"
where <PropertyName>
is a property in the items of your ItemsSource
.
Upvotes: 21
Reputation: 4774
I think you can resolve your problem by removing IsReadOnly property. You set it to true, so ComboBox doesn`t accept any input. If you don`t want an empty item as a first ComboBox item, you can set SelectedIndex="0".
Upvotes: 1