Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF ComboBox...how to set the .Text property?

Is there a way to set the .Text property of the Wpf ComboBox control directly?

My combobox is bound to a List<T> collection, but when I try to set .Text property in the DropDownClosed event, it totally ignores it.

like image 661
AngryHacker Avatar asked May 21 '09 20:05

AngryHacker


1 Answers

If you're trying to set the text to the text of one of the items in the list it should work correctly.

If you're trying to set it to an item that isn't in the list then the IsEditable property needs to be true. You can set the IsReadOnly property to true if you don't actually want users typing into the combo box.

If none of these cases fit you, can you post the code you're using?

like image 99
Ray Avatar answered Sep 20 '22 16:09

Ray