Dela via


ScrollViewer.AnchorRequested Event

Definition

Occurs when an anchor is requested at the beginning of the Arrange pass. Handle this event to override the ScrollViewer's default logic to select an anchor element as part of scroll anchoring.

// Register
event_token AnchorRequested(TypedEventHandler<ScrollViewer, AnchorRequestedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
ScrollViewer::AnchorRequested_revoker AnchorRequested(auto_revoke_t, TypedEventHandler<ScrollViewer, AnchorRequestedEventArgs const&> const& handler) const;
public event TypedEventHandler<ScrollViewer,AnchorRequestedEventArgs> AnchorRequested;
function onAnchorRequested(eventArgs) { /* Your code */ }
scrollViewer.addEventListener("anchorrequested", onAnchorRequested);
scrollViewer.removeEventListener("anchorrequested", onAnchorRequested);
- or -
scrollViewer.onanchorrequested = onAnchorRequested;
Public Custom Event AnchorRequested As TypedEventHandler(Of ScrollViewer, AnchorRequestedEventArgs) 

Event Type

Windows requirements

Device family
Windows 10, version 1809 (introduced in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v7.0)

Remarks

Explicitly set the Anchor property of the AnchorRequestedEventArgs to a UIElement within the ScrollViewer's subtree to override the default policy of choosing an anchor element. The AnchorCandidates property provides the list of candidates currently registered with the ScrollViewer.

Applies to

See also