PullToReload Class
Helps you create a "pull to reload" interaction with a ScrollView
.
It is implemented as a ScrollingAnimation
, with a set of properties that let you bind different states that should be triggered during different stages of interaction:
-
Pulling - Active when the user is actively pulling down beond the top of the content
-
PulledPastThreshold - Active when the user has pulled down enough to activate loading
-
Loading - Active when the "loading" has started. Loading starts when the user has pulled past the threshold, and then leaves the threshold area.
-
Rest - Active when the user has pulled down the content, but their last movement was upwards. In addition, you have a callback,
ReloadHandler
, which is called when theLoading
state activates. -
Note that
PullToReload
inherits from ScrollingAnimation and therefore can be tweaked further using its properties. Here is an example of how we can tweak it to be pulled from the bottom instead using theRange
property fromScrollingAnimation
:
<PullToReload Range="SnapMax">
...
</PullToReload>
See the Pull to reload, for a complete example on how to use it.
Example
The following example flashes the app background in different colors as the different states of the PullToReload
happen:
<ScrollView>
<PullToReload>
<Timeline ux:Name="redFlash">
<Change color.Color="#F00" Duration="1"/>
</Timeline>
<Timeline ux:Name="pinkFlash">
<Change color.Color="#FFC0DB" Duration="1"/>
</Timeline>
<Timeline ux:Name="greenFlash">
<Change color.Color="#0F0" Duration="1"/>
</Timeline>
<Timeline ux:Name="blueFlash">
<Change color.Color="#00F" Duration="1"/>
</Timeline>
<State ux:Binding="Pulling">
<Cycle Target="redFlash.Progress" Low="0" High="1" Frequency="1" />
</State>
<State ux:Binding="PulledPastThreshold">
<Cycle Target="pinkFlash.Progress" Low="0" High="1" Frequency="1" />
</State>
<State ux:Binding="Loading">
<Cycle Target="greenFlash.Progress" Low="0" High="1" Frequency="1" />
</State>
<State ux:Binding="Rest">
<Cycle Target="blueFlash.Progress" Low="0" High="1" Frequency="1" />
</State>
</PullToReload>
<StackPanel>
<Text Margin="20">The quick brown fox</Text>
<Text Margin="20">Jumps over the lazy dog</Text>
</StackPanel>
<SolidColor ux:Name="color" Color="#FFF"/>
</ScrollView>
Location
- Namespace
- Fuse.Triggers
- Package
- Fuse.Controls.ScrollView 2.9.1
Interface of PullToReload
Loading : State ux
PulledPastThreshold : State ux
Pulling : State ux
PullToReload Constructor uno
ReloadHandler : VisualEventHandler (object, VisualEventArgs) ux
Rest : State ux
Inherited from ScrollingAnimation
From : float ux
Inverse : bool ux
Range : ScrollingAnimationRange ux
ScrollDirections : ScrollDirections ux
To : float ux
Inherited from Trigger
Actions : IList of TriggerAction ux
A list of actions that execute with the trigger. These may react on simple direction changes, or at specific time offsets.
Activate(Action) uno
Animators : IList of Animator ux
BackwardAnimation : TriggerAnimation ux
Bypass : TriggerBypassMode ux
BypassActivate uno
BypassDeactivate uno
BypassSeek(double, AnimationVariant) uno
CrossFadeDuration : double ux
If there is a transition between forward/backward playback and two timeilnes are being used (implicit or explicit) this specifies the cross-fade time.
Deactivate uno
DirectActivate(Action) uno
DirectDeactivate uno
DirectSeek(double, AnimationVariant) uno
HasActions : bool uno
HasAnimators : bool uno
HasBackwardAnimation : bool uno
true
if there is an explicit backward animation.
InversePulse uno
OnPlayStateChanged(TriggerPlayState) uno
OnProgressChanged uno
PlayEnd(bool, Action) uno
Play the trigger from where it currently is to the end.
PlayTo(double, AnimationVariant) uno
Progress : double uno
Pulse uno
PulseBackward uno
RecreateAnimationState uno
RequireLayout(Visual) uno
Indicates the trigger is bound to the layout of a visual. This will keep the trigger in Bypass mode until after the first layout of the element is obtained. This is required since layout does not happen in the same root grouping/update phase as the creation of the element, yet not having a layout should qualify as part of the rooting period.
Seek(double, AnimationVariant) uno
Start uno
Stop(bool) uno
StretchDuration : double ux
Stretches the duration of the animation to fill up this period of time.
TimeMultiplier : double ux
Specifies a multiplier to the elapsed time for animation playback.
Inherited from NodeGroupBase
FindTemplate(string) : Template uno
Nodes : IList of Node ux
Nodes to add to the Parent when this trigger is any non-deactivated state (Progress > 0)
OnNodeAdded(Node) uno
OnNodeRemoved(Node) uno
Resources : IList of Resource ux
Templates : IList of Template ux
Inherited from Node
Add(Binding) uno
Bindings : IList of Binding ux
The list of bindings belonging to this node.
ContextParent : Node uno
The context parent is the semantic parent of this node. It is where non-UI structure should be resolved, like looking for the DataContext, a Navigation, or other semantic item.
FindByType<T> : T uno
FindNodeByName(Selector, Predicate<Node> (Node)) : Node uno
Finds the first node with a given name that satisfies the given acceptor. The serach algorithm works as follows: Nodes in the subtree are matched first, then it matches the nodes in the subtrees ofthe ancestor nodes by turn all the way to the root. If no matching node is found, the function returns null.
GetNearestAncestorOfType<T> : T uno
Insert(int, Binding) uno
IsRootingCompleted : bool uno
Whether rooting for this node is completed. Returns false if unrooting has started.
IsRootingStarted : bool uno
Whether rooting of this node has started. Note that even if this property returns true, rooting may not yet be completed for the node. See also IsRootingCompleted.
Name : Selector ux
Run-time name of the node. This property is automatically set using the ux:Name attribute.
NextSibling<T> : T uno
Returns the next sibling node of the given type.
OnDataChanged(string, object) uno
OnRooted uno
If you override OnRooted
you must call base.OnRooted()
first in your derived class. No other processing should happen first, otherwise you might end up in an undefined state.
OnUnrooted uno
Parent : Visual uno
The parent Visual of this node. Will return null if the node is not rooted.
PreviousSibling<T> : T uno
Returns the next sibling node of the given type.
Properties : Properties uno
A linked list holding data for extrinsic properties.
Remove(Binding) : bool uno
SoftDispose uno
SourceFileName : string ux
hide
SourceLineNumber : int ux
hide
SubtreeToString : string uno
SubtreeToString(StringBuilder, int) uno
TryGetResource(string, Predicate<object> (object), object) : bool uno
VisitSubtree(Action<Node> (Node)) uno
Inherited from PropertyObject
AddPropertyListener(IPropertyListener) uno
OnPropertyChanged(Selector, IPropertyListener) uno
OnPropertyChanged(Selector) uno
RemovePropertyListener(IPropertyListener) uno
Inherited from object
Equals(object) : bool uno
GetHashCode : int uno
GetType : Type uno
ToString : string uno
Attached UX Attributes
GlobalKey (attached by Resource) : string ux
Implemented Interfaces
IPropertyListener uno
IList<Binding> uno
IScriptObject uno
Interface for objects that can have a script engine representation
IProperties uno
ISourceLocation uno
hide