I capture the KeyUp event on an AutoComplete box from the Silverlight toolkit. If they press Escape I want to clear the value by calling autocompletebox.Text = string.Empty. This works most of the t开发者_JAVA百科ime, but whenever I set this when the whole field is selected it does not work. Is there another property that I should be setting instead of Text?
Try also assigning null to the SelectedItem
property.
BTW Why are you using the toolkit, Silverlight 4 has an AutoCompleteBox, are you using SL3?
For anyone who may encounter this problem, it turns out that while you can set the Text
property, the best approach is to set the SelectedItem
property. I will submit this as a bug on Codeplex.
精彩评论