ScrollingAnchorRequestedEventArgs Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides data for the ScrollView.AnchorRequested
event.
public ref class ScrollingAnchorRequestedEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.XamlContract, 327680)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ScrollingAnchorRequestedEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.XamlContract), 327680)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ScrollingAnchorRequestedEventArgs
Public NotInheritable Class ScrollingAnchorRequestedEventArgs
- Inheritance
- 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. |