Bagikan melalui


SearchPane.VisibilityChanged Kejadian

Definisi

Aktif saat pengguna membuka atau menutup 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 VisibilityChanged(TypedEventHandler<SearchPane, SearchPaneVisibilityChangedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
SearchPane::VisibilityChanged_revoker VisibilityChanged(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneVisibilityChangedEventArgs 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 VisibilityChanged(TypedEventHandler<SearchPane, SearchPaneVisibilityChangedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
SearchPane::VisibilityChanged_revoker VisibilityChanged(auto_revoke_t, TypedEventHandler<SearchPane, SearchPaneVisibilityChangedEventArgs 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,SearchPaneVisibilityChangedEventArgs> VisibilityChanged;
[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,SearchPaneVisibilityChangedEventArgs> VisibilityChanged;
function onVisibilityChanged(eventArgs) { /* Your code */ }
searchPane.addEventListener("visibilitychanged", onVisibilityChanged);
searchPane.removeEventListener("visibilitychanged", onVisibilityChanged);
- or -
searchPane.onvisibilitychanged = onVisibilityChanged;
Public Custom Event VisibilityChanged As TypedEventHandler(Of SearchPane, SearchPaneVisibilityChangedEventArgs) 

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 melemparkan pengecualian dengan pesan ini: "Tidak dapat membuat instans jenis 'Windows.UI.Xaml.Controls.SearchBox.'"

Daftar untuk diberi tahu ketika peristiwa ini diaktifkan dengan menambahkan pendengar peristiwa ke searchPane dan menetapkan fungsi handler untuk peristiwa tersebut. Anda dapat mengakses informasi tentang peristiwa dengan objek searchPaneVisibilityChangedEventArgs yang diteruskan ke penanganan aktivitas Anda.

Berlaku untuk

Lihat juga