Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.28 KB

autosuggestbox_suggestionchosen.md

File metadata and controls

43 lines (33 loc) · 1.28 KB
-api-id -api-type
E:Microsoft.UI.Xaml.Controls.AutoSuggestBox.SuggestionChosen
winrt event

Microsoft.UI.Xaml.Controls.AutoSuggestBox.SuggestionChosen

-description

Raised before the text content of the editable control component is updated.

-xaml-syntax

<AutoSuggestBox SuggestionChosen="eventhandler"/>

-remarks

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.

-examples

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;
}

-see-also

AutoSuggestBox