-api-id | -api-type |
---|---|
E:Windows.UI.Xaml.Controls.AutoSuggestBox.SuggestionChosen |
winrt event |
Raised before the text content of the editable control component is updated.
<AutoSuggestBox SuggestionChosen="eventhandler"/>
Respond to this event when you want to display information in the editable part of the control. An alternative way of updating the text when a suggestion is chosen is to use the TextMemberPath property.
When a book is chosen from a suggestion list, set the text area of AutoSuggestBox
to the book's title:
<AutoSuggestBox
ItemsSource="{x:Bind Books}"
SuggestionChosen="AutoSuggestBox_SuggestionChosen"
UpdateTextOnSelect="True" />
private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
{
var book = args.SelectedItem as Book;
sender.Text = book.Title;
}