
|
<syncfusion:SfPullToRefresh x:Name="pullToRefresh"
PullingThreshold="120"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
RefreshContentHeight="30"
RefreshContentThreshold="30"
Refreshing="pullToRefresh_Refreshing"
RefreshContentWidth="30" >
<syncfusion:SfPullToRefresh.RefreshingViewTemplate>
<DataTemplate>
<ActivityIndicator IsRunning="{Binding IsRefreshing , Source={x:Reference pullToRefresh}}" />
</DataTemplate>
</syncfusion:SfPullToRefresh.RefreshingViewTemplate>
<syncfusion:SfPullToRefresh.PullableContent>
<sfList:SfListView x:Name="listView"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
ItemsSource="{Binding BookInfo}"> |
|
private SfCircularProgressBar progressbar;
private SfBorder border;
public PullToRefreshPage()
{
InitializeComponent();
this.progressbar = new SfCircularProgressBar();
this.border = new SfBorder();
this.border.BorderColor = Color.LightGray;
this.border.BackgroundColor = Color.White;
this.border.CornerRadius = 35;
this.border.Content = this.progressbar;
this.border.BorderWidth = 0.2;
this.progressbar.SegmentCount = 10;
this.progressbar.IndicatorInnerRadius = 0.5;
this.progressbar.IndicatorOuterRadius = 0.7;
this.progressbar.ShowProgressValue = false;
this.progressbar.GapWidth = 0.5;
this.progressbar.WidthRequest = 70;
this.progressbar.HeightRequest = 55;
this.progressbar.IndeterminateAnimationDuration = 750;
var pullingTemplate = new DataTemplate(() =>
{
return new ViewCell { View = this.border };
});
this.pullToRefresh.PullingViewTemplate = pullingTemplate;
}
private async void pullToRefresh_Refreshing(object sender, EventArgs e)
{
pullToRefresh.IsRefreshing = true;
await Task.Delay(new TimeSpan(0, 0, 3));
viewModel.LoadMoreItems();
pullToRefresh.IsRefreshing = false;
}
void pullToRefresh_Pulling(System.Object sender, Syncfusion.SfPullToRefresh.XForms.PullingEventArgs e)
{
this.progressbar.TrackInnerRadius = 0.8;
this.progressbar.TrackOuterRadius = 0.1;
this.progressbar.IsIndeterminate = false;
this.progressbar.ProgressColor = Color.FromRgb(0, 124, 238);
this.progressbar.TrackColor = Color.White;
var absoluteProgress = Math.Abs(e.Progress);
this.progressbar.Progress = absoluteProgress;
this.progressbar.SetProgress(absoluteProgress, 1, Easing.CubicInOut);
}
} |