I have an editable ComboBox:
<ComboBox IsEditable="true"/>
What is the event that is raised when the edited value is changed? I have tried TextInput but that is not the solution.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
…should do it. (Assuming you want something that will fire every time a change is made to the text, rather then when the user has finished entering the text. In which case you’d need another event – maybe a LostFocus event or something?)
Anyway, the reason why the above XAML works is that, when IsEditable is set to true, the ComboBox uses a TextBox for displaying and editing the text. The TextBox’s TextChanged event is a bubbling event – meaning it will bubble up through the element tree so we can handle it on the ComboBox itself.
The only ‘tricky’ bit is that ComboBox doesn’t expose a TextChanged event itself but you can still define a handler for it using an attached event (hence the TextBoxBase.TextChanged syntax).
(It’s probably worth noting for completeness, that if the ComboBox happened to contain more than one TextBox then the handler would be called whenever any of them had their text changed.)