Scrolls a ScrollView to a given position when triggered.

Absolute position

To scroll to an absolute position, provide a value to the Position property. This property accepts a pair of numbers, representing X and Y coordinates.

<ScrollTo Target="myScrollView" Position="0, 50" />
Relative position

Alternatively, you can scroll to a relative position using the RelativePosition property.

RelativePosition also accepts a pair of numbers, representing X and Y coordinates. Each coordinate should be in the range 0..1, where 1 represents the largest distance the user can scroll in that direction. For instance, a RelativePosition of 1, 1 will scroll to the bottom-right corner.

<ScrollTo Target="myScrollView" RelativePosition="0, 0.5" />

When triggered, the above will scroll myScrollView to the vertical center of its scrollable area.

Example

<DockPanel>
    <Button Dock="Top" Text="Scroll to top" Margin="20">
        <Clicked>
            <ScrollTo Target="myScrollView" Position="0,0" />
        </Clicked>
    </Button>

    <ScrollView ux:Name="myScrollView">
        <Rectangle Height="2000">
            <LinearGradient>
                <GradientStop Offset="0" Color="Red" />
                <GradientStop Offset="1" Color="Blue" />
            </LinearGradient>
        </Rectangle>
    </ScrollView>
</DockPanel>

Location

Namespace
Fuse.Gestures
Package
Fuse.Controls.ScrollView 2.9.1
Show Uno properties and methods

Interface of ScrollTo

Inherited from TriggerAction

AtProgress : float ux

A value between 0 and 1 for when the action should be performed. Alternative to Delay.

Delay : float ux

The number of seconds after the start of the trigger that the action should be performed.

TargetNode : Node ux

The node that the action targets. If not specified then the enclsoing Trigger will be used. Several triggers can look for a target starting from this point. Some triggers require a Target to be specified.

Unroot uno

Called when the owner of this object is unrooted. This gives an action to cleanup resources or cancel pending actions.

Inherited from PropertyObject

Inherited from object

Attached UX Attributes

GlobalKey (attached by Resource) : string ux

The ux:Global attribute creates a global resource that is accessible everywhere in UX markup.

Implemented Interfaces