UIElement.BringIntoViewRequested 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
调用此元素或其子代之一时 StartBringIntoView 发生。
适用于 UWP 的等效 WinUI 2 API:Windows 应用 SDK中 WinUI 的 Microsoft.UI.Xaml.UIElement.BringIntoViewRequested (,请参阅Windows 应用 SDK命名空间) 。
// 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 中引入)
|
注解
备注
框架还可以引发事件,以响应通过键盘或游戏板接收焦点的元素,或者当辅助技术对元素的自动化对等方执行 IScrollItemProvider's ScrollIntoView 方法时。
此事件使控件能够参与将元素引入视图的过程。 它向父控件(如 a) ScrollViewer指示引发事件的元素应在可滚动区域中可见。 非滚动控件可以通过修改事件数据 (BringIntoViewRequestedEventArgs) 来更改源自其子级的请求的方法。 例如,可以侦听父元素上的事件,以 TargetRect 放大并确保在将任何子元素引入视图中时包含最少的填充量。
通常,不应将事件数据 (BringIntoViewRequestedEventArgs) 标记为处理。 调用 StartBringIntoView 时,这样做可能会干扰预期目标。 当事件浮出水面以更改请求时,可能会修改其他事件数据。 具体而言,父滚动控件应修改事件数据以考虑其贡献,无论是部分还是完全满足请求。 至少应将滚动器设置为自己的 TargetElement 坐标空间并更新 TargetRect 其自己的坐标空间。 如果元素位于滚动器中,而滚动器本身位于滚动器中,则每个元素必须做出响应以满足所请求的对齐方式。
OriginalSource应使用该元素来确定最初引发事件的元素,因为TargetElement该元素可能修改为事件气泡。
BringIntoViewRequested 是路由事件。 有关路由事件概念的详细信息,请参阅 事件和路由事件概述。
适用于
另请参阅
反馈
提交和查看相关反馈