Class SfPullToRefresh
SfPullToRefresh enables interaction to refresh the loaded view. This control allows users to trigger a refresh action by performing the pull-to-refresh gesture.
Implements
Inherited Members
Namespace: Syncfusion.Maui.PullToRefresh
Assembly: Syncfusion.Maui.PullToRefresh.dll
Syntax
public class SfPullToRefresh : PullToRefreshExt, IDrawableLayout, IDrawable, IAbsoluteLayout, ILayout, IView, IElement, ITransform, IContainer, IList<IView>, ICollection<IView>, IEnumerable<IView>, IEnumerable, ISafeAreaView, IPadding, ICrossPlatformLayout, IVisualTreeElement, ISemanticsProvider, ITouchListener, IParentThemeElement, IThemeElement
Constructors
SfPullToRefresh()
Initializes a new instance of the SfPullToRefresh class.
Declaration
public SfPullToRefresh()
Fields
CanRestrictChildTouchProperty
Identifies the CanRestrictChildTouch bindable property.
Declaration
public static readonly BindableProperty CanRestrictChildTouchProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
IsRefreshingProperty
Identifies the IsRefreshing bindable property.
Declaration
public static readonly BindableProperty IsRefreshingProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ProgressBackgroundProperty
Identifies the ProgressBackground bindable property.
Declaration
public static readonly BindableProperty ProgressBackgroundProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ProgressColorProperty
Identifies the ProgressColor bindable property.
Declaration
public static readonly BindableProperty ProgressColorProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ProgressThicknessProperty
Identifies the ProgressThickness bindable property.
Declaration
public static readonly BindableProperty ProgressThicknessProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PullableContentProperty
Identifies the PullableContent bindable property.
Declaration
public static readonly BindableProperty PullableContentProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PullingThresholdProperty
Identifies the PullingThreshold bindable property.
Declaration
public static readonly BindableProperty PullingThresholdProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
PullingViewTemplateProperty
Identifies the PullingViewTemplate bindable property.
Declaration
public static readonly BindableProperty PullingViewTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
RefreshCommandParameterProperty
Identifies the RefreshCommandParameter bindable property.
Declaration
public static readonly BindableProperty RefreshCommandParameterProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
RefreshCommandProperty
Identifies the RefreshCommand bindable property.
Declaration
public static readonly BindableProperty RefreshCommandProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
RefreshingViewTemplateProperty
Identifies the RefreshingViewTemplate bindable property.
Declaration
public static readonly BindableProperty RefreshingViewTemplateProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
RefreshViewHeightProperty
Identifies the RefreshViewHeight bindable property.
Declaration
public static readonly BindableProperty RefreshViewHeightProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
RefreshViewThresholdProperty
Identifies the RefreshViewThreshold bindable property.
Declaration
public static readonly BindableProperty RefreshViewThresholdProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
RefreshViewWidthProperty
Identifies the RefreshViewWidth bindable property.
Declaration
public static readonly BindableProperty RefreshViewWidthProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
TransitionModeProperty
Identifies the TransitionModeProperty bindable property.
Declaration
public static readonly BindableProperty TransitionModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
CanRestrictChildTouch
Gets or sets a value indicating whether PullableContent touch interactions should be allowed or not. The default value is false.
Declaration
public bool CanRestrictChildTouch { get; set; }
Property Value
Type |
---|
System.Boolean |
IsRefreshing
Gets or sets a value indicating whether SfPullToRefresh is in refreshing state.
Declaration
public bool IsRefreshing { get; set; }
Property Value
Type |
---|
System.Boolean |
ProgressBackground
Gets or sets the background of the progress circle view.
Declaration
public Brush ProgressBackground { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.Brush |
ProgressColor
Gets or sets the color of the progress indicator.
Declaration
public Color ProgressColor { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Graphics.Color |
ProgressThickness
Gets or sets the thickness of the progress indicator. The default value is 3d.
Declaration
public double ProgressThickness { get; set; }
Property Value
Type |
---|
System.Double |
PullableContent
Gets or sets the pullable content of SfPullToRefresh.
Declaration
public View PullableContent { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.View |
Examples
<Syncfusion:SfPullToRefresh x:Name="pullToRefresh"
PullingThreshold="120"
RefreshViewHeight="30"
RefreshViewThreshold="30"
RefreshViewWidth="30">
<Syncfusion:SfPullToRefresh.PullableContent>
<Label x:Name="month"
TextColor="White"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Start" />
</Syncfusion:SfPullToRefresh.PullableContent>
</Syncfusion:SfPullToRefresh>
PullingThreshold
Gets or sets the maximum pulling Y position of the progress circle view. The default value is 200d.
Declaration
public double PullingThreshold { get; set; }
Property Value
Type |
---|
System.Double |
See Also
PullingViewTemplate
Gets or sets the template to be displayed as the refresh content when pulling.
Declaration
public DataTemplate PullingViewTemplate { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.DataTemplate |
See Also
RefreshCommand
Gets or sets the refresh command.
Declaration
public ICommand RefreshCommand { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
Remarks
The command's CanExecute() will be triggered when the pulling action is performed.
If false
is returned from CanExecute(), the pulling will be canceled, and the command will not be executed, and refreshing does not happen.
If true
is returned from CanExecute(), the command will be executed on refreshing.
Examples
SfPullToRefresh pullToRefresh = new SfPullToRefresh();
CommandViewModel viewModel = new CommandViewModel();
pullToRefresh.RefreshCommand = viewModel.ViewRefreshCommand;
pullToRefresh.RefreshCommandParameter = pullToRefresh;
public class CommandViewModel
{
private Command<Object> viewRefreshCommand;
public Command<object> ViewRefreshCommand
{
get { return viewRefreshCommand; }
set { viewRefreshCommand = value; }
}
public CommandViewModel()
{
ViewRefreshCommand = new Command<object>(CanExecuteRefreshMethod,RefreshMethod);
}
private void CanExecuteRefreshMethod()
{
return true;
}
private void RefreshMethod(object obj)
{
(obj as SfPullToRefresh).IsRefreshing = true;
await Task.Delay(1200);
this.ItemsSourceRefresh();
(obj as SfPullToRefresh).IsRefreshing = false;
}
}
RefreshCommandParameter
Gets or sets the parameter of the RefreshCommand.
Declaration
public object RefreshCommandParameter { get; set; }
Property Value
Type |
---|
System.Object |
Examples
SfPullToRefresh pullToRefresh = new SfPullToRefresh();
CommandViewModel viewModel = new CommandViewModel();
pullToRefresh.RefreshCommand = viewModel.ViewRefreshCommand;
pullToRefresh.RefreshCommandParameter = pullToRefresh;
public class CommandViewModel
{
private Command<Object> viewRefreshCommand;
public Command<object> ViewRefreshCommand
{
get { return viewRefreshCommand; }
set { viewRefreshCommand = value; }
}
public CommandViewModel()
{
ViewRefreshCommand = new Command<object>(CanExecuteRefreshMethod,RefreshMethod);
}
private void CanExecuteRefreshMethod()
{
return true;
}
private void RefreshMethod(object obj)
{
(obj as SfPullToRefresh).IsRefreshing = true;
await Task.Delay(1200);
this.ItemsSourceRefresh();
(obj as SfPullToRefresh).IsRefreshing = false;
}
}
RefreshingViewTemplate
Gets or sets the template to be displayed as the refresh content on refreshing.
Declaration
public DataTemplate RefreshingViewTemplate { get; set; }
Property Value
Type |
---|
Microsoft.Maui.Controls.DataTemplate |
See Also
RefreshViewHeight
Gets or sets the height of the progress circle view. The default value is 48d.
Declaration
public double RefreshViewHeight { get; set; }
Property Value
Type |
---|
System.Double |
See Also
RefreshViewThreshold
Gets or sets the starting position of the progress circle view in SlideOnTop. The default value is 50d.
Declaration
public double RefreshViewThreshold { get; set; }
Property Value
Type |
---|
System.Double |
See Also
RefreshViewWidth
Gets or sets the width of the progress circle view. The default value is 48d.
Declaration
public double RefreshViewWidth { get; set; }
Property Value
Type |
---|
System.Double |
See Also
TransitionMode
Gets or sets the transition mode of SfPullToRefresh. The default transition mode is SlideOnTop.
Declaration
public PullToRefreshTransitionType TransitionMode { get; set; }
Property Value
Type |
---|
PullToRefreshTransitionType |
Remarks
In SlideOnTop mode, the progress circle view will be layout over the PullableContent based on pulling progress. In Push mode, the PullableContent will layout below the progress circle view. Both the circle view and PullableContent will be moved based on pulling progress.
Methods
ArrangeContent(Rect)
Methods arranges the PullableContent and Syncfusion.Maui.PullToRefresh.SfPullToRefresh.ProgressCircleView.
Declaration
protected override Size ArrangeContent(Rect bounds)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Maui.Graphics.Rect | bounds | Bounds of the SfPullToRefresh. |
Returns
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | Returns the bounds of the SfPullToRefresh. |
Overrides
EndRefreshing()
Ends refreshing the PullableContent and stops the refreshing animation.
Declaration
public void EndRefreshing()
MeasureContent(Double, Double)
Measures the PullableContent and Syncfusion.Maui.PullToRefresh.SfPullToRefresh.ProgressCircleView.
Declaration
protected override Size MeasureContent(double widthConstraint, double heightConstraint)
Parameters
Type | Name | Description |
---|---|---|
System.Double | widthConstraint | The available width for SfPullToRefresh. |
System.Double | heightConstraint | The available height for SfPullToRefresh. |
Returns
Type | Description |
---|---|
Microsoft.Maui.Graphics.Size | Returns the required size. |
Overrides
OnHandlerChanged()
Raised when handler gets changed.
Declaration
protected override void OnHandlerChanged()
Overrides
StartRefreshing()
Starts refreshing the PullableContent and displays the refreshing animation.
Declaration
public void StartRefreshing()
Events
Pulling
Occurs when the pulling operation is performed.
Declaration
public event EventHandler<PullingEventArgs> Pulling
Event Type
Type |
---|
System.EventHandler<PullingEventArgs> |
See Also
Refreshed
Occurs when the refreshing operation completes.
Declaration
public event EventHandler<EventArgs> Refreshed
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |
See Also
Refreshing
Occurs when the refreshing operation starts.
Declaration
public event EventHandler<EventArgs> Refreshing
Event Type
Type |
---|
System.EventHandler<System.EventArgs> |