Events
This article lists the events specific for RadAutoSuggestBox.
-
TextChanged: Occurs on each change in the text of the TextBox part of the control. The event arguments are of type TextChangedEventArgs and expose the following members:
-
Reason: A property of type TextChangeReason that allows you to identify how the text was changed - Programmatic, via UserInput or on SuggestionChosen.
Example 1: TextChanged event handler
-
private void RadAutoSuggestBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (e.Reason == TextChangeReason.UserInput)
{
this.radAutoSuggestBox.ItemsSource = MyGetFilteredItems(this.radAutoSuggestBox.SearchText);
}
}
-
QuerySubmitted: Occurs when the user submits a query. This happens on the following occasions - Enter press while the control is focused and the drop down is opened, a click over the query button or choosing suggestion from the drop down list. The event arguments are of type QuerySubmittedEventArgs and expose the following members:
-
QueryText: A property that holds the currently searched text.
-
Suggestion: A property of type object, that holds a reference to the chosen suggestion. If no suggestion was selected the property value is
null. -
The following example uses the
CountryInfomodel from the Getting Started article.Example 2: QuerySubmitted event handler
-
private void RadAutoSuggestBox_QuerySubmitted(object sender, QuerySubmittedEventArgs e)
{
}
-
SuggestionChosen: Occurs when a suggestion is chosen from the drop down list. The event arguments are of type SuggestionChosenEventArgs and expose the following members:
-
Suggestion: A property of type object, that holds a reference to the chosen suggestion.
Example 3: SuggestionChosen event handler
-
private void RadAutoSuggestBox_SuggestionChosen(object sender, SuggestionChosenEventArgs e)
{
}