Share via


ScrollingAnchorRequestedEventArgs Class

Definition

Provides data for the ScrollView.AnchorRequested event.

[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ScrollingAnchorRequestedEventArgs
Inheritance
Object ScrollingAnchorRequestedEventArgs
Attributes

Remarks

These event args are used by the ScrollView.AnchorRequested event, which is raised when the ScrollView is selecting an element to be anchored. Handle this event to customize that selection.

If the event handler leaves the AnchorElement as null, then the ScrollView selects an anchor from among the AnchorCandidates collection.

The AnchorCandidates collection is initialized with the elements that are registered as anchor candidates. That initial collection of candidates is populated with ScrollPresenter children that have their the UIElement.CanBeScrollAnchor property set to true, and with elements explicitly registered with the ScrollView.RegisterAnchorCandidate method.

You can use AnchorRequested event handler to modify that collection to adjust the list of candidates for the anchor request. After it is executed, the ScrollView uses its HorizontalAnchorRatio and VerticalAnchorRatio properties to select an anchor among the final AnchorCandidates collection.

Alternatively, you can use the AnchorRequested event handler to set the AnchorElement property, initialized to null, to force the use of a particular element as the anchor. In that case, the AnchorCandidates collection is ignored and the ScrollView's selection process is skipped entirely.

Properties

AnchorCandidates

Gets the collection of anchor element candidates to pick from.

AnchorElement

Gets or sets the selected anchor element.

Applies to

Product Versions
Windows App SDK 1.4, 1.5, 1.6

See also