We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to implement the PullToRefreshCommand?

Thread ID:

Created:

Updated:

Platform:

Replies:

125435 Aug 17,2016 02:21 PM UTC Aug 18,2016 10:19 AM UTC Xamarin.iOS 2
loading
Tags: SfDataGrid
Eray Cakal
Asked On August 17, 2016 02:21 PM UTC

i can't set up the PullToRefreshCommand like described in the Example:

//Enable PullToRefresh in SfDataGrid
dataGrid.AllowPullToRefresh = true;
dataGrid.PullToRefreshCommand = new Command(ExecutePullToRefreshCommand);
I got an error for Command: CS0246  C# The type or namespace name could not be found (are you missing a using directive or an assembly reference?) 
Do i need another assembly or what am i doing wrong?


Eray Cakal
Replied On August 18, 2016 07:38 AM UTC

Solved by implementing the Interface

Divakar Subramaniam [Syncfusion]
Replied On August 18, 2016 10:19 AM UTC

Hi Eray,   
   
Thank you for contacting Syncfusion Support.   
   
In Xamarin.Forms, there is an in-build class called Command which you can use it. However, in Xamarin.iOS there is no such class and you need to write a command implementing from the ICommand interface in your sample in order to use commands in Xamarin.iOS.   
   
Please refer the below code example for the Command class implementation.     
   
//Enable PullToRefresh in SfDatagrid   
dataGrid.AllowPullToRefresh = true;   
dataGrid.PullToRefreshCommand = new Command (ExecuteCommand);   
   
//Command.cs   
public class Command : ICommand   
{   
    private Action execute;   
    private bool canExecute = true;   
   
    public event EventHandler CanExecuteChanged;   
   
    public Command(Action action)   
    {   
        execute = action;   
    }   
   
    public bool CanExecute(object parameter)   
    {   
        return canExecute;   
    }   
   
    public void Execute(object parameter)   
    {   
        changeCanExecute(true);   
        execute.Invoke();   
    }   
   
    private void changeCanExecute(bool canExecute)   
    {   
        this.canExecute = canExecute;   
        if (CanExecuteChanged != null)   
            CanExecuteChanged(thisnew EventArgs());   
    }   
}   
  
 
We have also included the code in our UG as well and it will be refreshed in live shortly. You can refer it below UG link,   
 
Regards, 
Divakar.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;