Bagikan melalui


AutoSuggestBox.SuggestionChosen Kejadian

Definisi

Dimunculkan sebelum konten teks komponen kontrol yang dapat diedit diperbarui.

// Register
event_token SuggestionChosen(TypedEventHandler<AutoSuggestBox, AutoSuggestBoxSuggestionChosenEventArgs const&> const& handler) const;

// Revoke with event_token
void SuggestionChosen(event_token const* cookie) const;

// Revoke with event_revoker
AutoSuggestBox::SuggestionChosen_revoker SuggestionChosen(auto_revoke_t, TypedEventHandler<AutoSuggestBox, AutoSuggestBoxSuggestionChosenEventArgs const&> const& handler) const;
public event TypedEventHandler<AutoSuggestBox,AutoSuggestBoxSuggestionChosenEventArgs> SuggestionChosen;
function onSuggestionChosen(eventArgs) { /* Your code */ }
autoSuggestBox.addEventListener("suggestionchosen", onSuggestionChosen);
autoSuggestBox.removeEventListener("suggestionchosen", onSuggestionChosen);
- or -
autoSuggestBox.onsuggestionchosen = onSuggestionChosen;
Public Custom Event SuggestionChosen As TypedEventHandler(Of AutoSuggestBox, AutoSuggestBoxSuggestionChosenEventArgs) 
<AutoSuggestBox SuggestionChosen="eventhandler"/>

Jenis Acara

Contoh

Saat buku dipilih dari daftar saran, atur area AutoSuggestBox teks ke judul buku:

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

Keterangan

Tanggapi kejadian ini jika Anda ingin menampilkan informasi di bagian kontrol yang dapat diedit. Cara alternatif untuk memperbarui teks saat saran dipilih adalah dengan menggunakan properti TextMemberPath .

Berlaku untuk

Lihat juga