jamesmontemagno / Xamarin.Forms-PullToRefreshLayout

Pull To Refresh a ScrollView or ListView in Xamarin.Forms
218 stars 49 forks source link

Not Call Refresh Commad #52

Closed uzeyiroztemur closed 4 years ago

uzeyiroztemur commented 6 years ago

RefreshCommand does not work.

pull ok! but onRefresh() -> does not trigger

Xaml

<controls:PullToRefreshLayout IsPullToRefreshEnabled="True" RefreshCommand="{Binding PullRefreshCommand, Mode=OneWayToSource}" IsRefreshing="{Binding IsBusy}" RefreshColor="Blue"> <ScrollView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <local:PageWebView x:Name="PageWebView" EvaluateJavascript="{Binding EvaluateJavascript, Mode=OneWayToSource}" Navigated="Browser_Navigated" CanGoBackFunction="{Binding CanGoBack, Mode=OneWayToSource}" GoBackCommand="{Binding GoBackCommand, Mode=OneWayToSource}" RefreshCommand="{Binding WebViewRefresh, Mode=OneWayToSource}"/> </StackLayout> </ScrollView> </controls:PullToRefreshLayout>

ViewModel

private ICommand pullRefreshCommand; public MainViewModel() { pullRefreshCommand = new Command(onRefresh); } public ICommand PullRefreshCommand { get => pullRefreshCommand; set => pullRefreshCommand = value; }

    private void onRefresh()
    {
        this.IsBusy = true;
        this.WebViewRefresh();
        this.IsBusy = false;
    }
awaescher commented 6 years ago

Did you call PullToRefreshLayoutRenderer.Init(); in your iOS and Android projects?

jamesmontemagno commented 4 years ago

Please use the RefreshView as this is officially deprecated now https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/refreshview