ScrollViewer.RegisterAnchorCandidate(UIElement) 方法

定义

UIElement 注册为潜在的滚动定位点。

public:
 virtual void RegisterAnchorCandidate(UIElement ^ element) = RegisterAnchorCandidate;
void RegisterAnchorCandidate(UIElement const& element);
public void RegisterAnchorCandidate(UIElement element);
function registerAnchorCandidate(element)
Public Sub RegisterAnchorCandidate (element As UIElement)

参数

element
UIElement

ScrollViewer 子树中的 UIElement

实现

Windows 要求

设备系列
Windows 10, version 1809 (在 10.0.17763.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v7.0 中引入)

注解

当元素将 CanBeScrollAnchor 设置为 true 时,框架会在该元素的上级链中找到第一个 IScrollAnchorProvider ,并自动调用其 RegisterAnchorCandidate 方法。 在现有元素上设置 属性或将元素添加到已设置属性的实时树时,都会出现这种情况。

同样,当 属性设置为 false (或者从可视化树中删除元素,并将属性设置为 true) 时,框架在第一个 IScrollAnchorProvider 上调用 UnregisterAnchorCandidate

适用于

另请参阅