views:

155

answers:

1

I have a WPF ComboBox (IsEditable = True) that is being populated with items based on the Text entered. I have a property that is bound to ItemsSource. This property is updated in a KeyUp event handler on the ComboBox.

The issue I'm having is that when all the text is selected and a new key is pressed - replacing all the highlighted text with a new character - the new character is removed from the ComboBox when the property bound to ItemsSource is updated and I end up with no text. Additional characters entered will stick around.

The end affect is that entering the ComboBox and then typing 'ab' ends up removing the 'a' then searching for 'b' and displaying only 'b' as the Text.

Is there a way to prevent this?

A: 

It sounds like what you are looking for is AutoComplete functionality.

http://askernest.com/archive/2008/01/23/how-to-make-a-basic-autocomplete-textbox-using-wpf.aspx

Robert Harvey