UIElement.BringIntoViewRequested 事件

定義

在這個專案或其其中一個子系上呼叫 StartBringIntoView 時發生。

// Register
event_token BringIntoViewRequested(TypedEventHandler<UIElement, BringIntoViewRequestedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
UIElement::BringIntoViewRequested_revoker BringIntoViewRequested(auto_revoke_t, TypedEventHandler<UIElement, BringIntoViewRequestedEventArgs const&> const& handler) const;
public event TypedEventHandler<UIElement,BringIntoViewRequestedEventArgs> BringIntoViewRequested;
function onBringIntoViewRequested(eventArgs) { /* Your code */ }
uIElement.addEventListener("bringintoviewrequested", onBringIntoViewRequested);
uIElement.removeEventListener("bringintoviewrequested", onBringIntoViewRequested);
- or -
uIElement.onbringintoviewrequested = onBringIntoViewRequested;
Public Custom Event BringIntoViewRequested As TypedEventHandler(Of UIElement, BringIntoViewRequestedEventArgs) 

事件類型

Windows 需求

裝置系列
Windows 10, version 1803 (已於 10.0.17134.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v6.0 引進)

備註

注意

架構也可以引發 事件,以回應透過鍵盤或遊戲台接收焦點的專案,或當輔助技術在元素的自動化對等端執行 IScrollItemProviderScrollIntoView 方法時。

此事件可讓控制項參與將專案帶入檢視的程式。 它會向 ScrollViewer等父控制項指出引發事件的元素應該顯示在可捲動區域內。 非捲動控制項可以使用 事件,藉由修改 BringIntoViewRequestedEventArgs () 事件資料,來改變源自其中一個子系的要求。 例如,您可以在父元素上接聽 事件,以放大 TargetRect ,並確保將任何子項目帶入檢視時,包含最少的填補量。

一般而言, BringIntoViewRequestedEventArgs () 的事件資料不應標示為已處理。 這麼做可能會干擾呼叫 StartBringIntoView 時的預期目標。 當事件反升以改變要求時,可能會修改其他事件資料。 具體來說,父捲動控制項預期會修改事件資料以考慮其貢獻,無論是部分或完全滿足要求。 捲動器至少應該將本身設定為 TargetElement ,並將 TargetRect 更新為自己的座標空間。 如果元素位於捲動器內,而其本身位於滾動器內,則每個專案都必須回應以符合要求的對齊方式。

如果TargetElement可以修改為事件泡泡,則 OriginalSource應該用來判斷最初引發事件的元素。

BringIntoViewRequested 是路由事件。 如需路由事件概念的詳細資訊,請參閱 事件和路由事件概觀

適用於

另請參閱