Bagikan melalui


SearchPane.ResultSuggestionChosen Kejadian

Definisi

Diaktifkan saat pengguna memilih salah satu hasil yang disarankan yang disediakan oleh aplikasi dan ditampilkan di panel pencarian.

/// [add: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.ApplicationModel.Search.SearchContract)]
/// [remove: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.ApplicationModel.Search.SearchContract)]
// Register
event_token ResultSuggestionChosen(TypedEventHandler<SearchPane, SearchPaneResultSuggestionChosenEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
SearchPane::ResultSuggestionChosen_revoker ResultSuggestionChosen(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneResultSuggestionChosenEventArgs const&> const& handler) const;
/// [add: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
/// [remove: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
// Register
event_token ResultSuggestionChosen(TypedEventHandler<SearchPane, SearchPaneResultSuggestionChosenEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
SearchPane::ResultSuggestionChosen_revoker ResultSuggestionChosen(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneResultSuggestionChosenEventArgs const&> const& handler) const;
[add: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.ApplicationModel.Search.SearchContract))]
[remove: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.ApplicationModel.Search.SearchContract))]
public event TypedEventHandler<SearchPane,SearchPaneResultSuggestionChosenEventArgs> ResultSuggestionChosen;
[add: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
[remove: Windows.Foundation.Metadata.Deprecated("ISearchPane may be altered or unavailable for releases after Windows 10.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.ApplicationModel.Search.SearchContract")]
public event TypedEventHandler<SearchPane,SearchPaneResultSuggestionChosenEventArgs> ResultSuggestionChosen;
function onResultSuggestionChosen(eventArgs) { /* Your code */ }
searchPane.addEventListener("resultsuggestionchosen", onResultSuggestionChosen);
searchPane.removeEventListener("resultsuggestionchosen", onResultSuggestionChosen);
- or -
searchPane.onresultsuggestionchosen = onResultSuggestionChosen;
Public Custom Event ResultSuggestionChosen As TypedEventHandler(Of SearchPane, SearchPaneResultSuggestionChosenEventArgs) 

Jenis Acara

Atribut

Keterangan

Penting

Untuk mengimplementasikan pencarian di aplikasi untuk Windows 10 atau yang lebih baru, gunakan AutoSuggestBox. Lihat kotak Saran otomatis untuk informasi selengkapnya.

Anda tidak boleh menggunakan API Windows.ApplicationModel.Search (SearchPane, SearchContract) atau SEARCHBox API di aplikasi untuk Windows 10 atau yang lebih baru.

Catatan

Aplikasi tidak dapat menggunakan kotak pencarian (Windows.UI.Xaml.Controls.SearchBox/WinJS.UI.SearchBox) dan SearchPane. Menggunakan kotak pencarian dan panel pencarian di aplikasi yang sama menyebabkan aplikasi melempar pengecualian dengan pesan ini: "Tidak dapat membuat instans jenis 'Windows.UI.Xaml.Controls.SearchBox.'"

Jika aplikasi Anda berpartisipasi dalam kontrak Pencarian dan menampilkan saran untuk kemungkinan hasil di panel pencarian, Anda harus mendaftarkan penanganan aktivitas untuk merespons saat peristiwa ini diaktifkan. Di penanganan aktivitas ResultSuggestionChosen Anda, tanggapi dengan mendapatkan SearchPaneResultSuggestionChosenEventArgs. Tag hasil yang dipilih dan menggunakannya untuk membawa pengguna ke hasil di UI aplikasi Anda.

Catatan

Jika Anda ingin menampilkan saran hasil, Anda juga harus mendengarkan dan menangani peristiwa SuggestionsRequested .

Berlaku untuk

Lihat juga