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. Image for the cookie policy date
close icon

PullToRefresh and DataGrid using MVVMCross 6.3.0

Hello,

I'm trying to adapt the sample of your pulltorefreshbehavior to get a datagrid actually refreshed, but I can't find the way to do it. Because your samples assumes one can simply create a new instance of some kind of anemic viewmodel (for example, check this). That is not a real world scenario.

In my case, the viewmodel I'm binding to the MvxContentPage inherits from MvxViewModel so I can't simply create a new instance, there are dependencies injected, so the idea of "new whatever()" dont work.

I request your help to get a working sample of the behavior using MVVMCross 6.3.0

2 Replies

PK Pradeep Kumar Balakrishnan Syncfusion Team June 4, 2019 06:10 PM UTC

 
Thank you for contacting Syncfusion support. 
 
Currently, we are preparing sample for your requirement “PullToRefresh with SfDatagrid sample in MVVM cross 6.3” in Xamarin forms. We will update the sample in one business days (June 6,2019). We appreciate your patience until then. 
 
Regards, 
Pradeep Kumar B 



PK Pradeep Kumar Balakrishnan Syncfusion Team June 6, 2019 08:35 PM UTC

Hi Jorge, 
 
Thank you for your patience. 
 
We have prepared a sample for your requirement in MVVMCross 6.3 and written behavior for content page and not created new instance for viewmodel instead we have accessed viewmodel from content page binding context. Please refer the following code for reference. 
 
Code snippet: 
protected override void OnBindingContextChanged() 
{ 
    base.OnBindingContextChanged(); 
    BindingContext = AssociatedObject.BindingContext; 
    if(AssociatedObject.BindingContext is PlanetsViewModel) 
    { 
        viewModel = AssociatedObject.BindingContext as PlanetsViewModel; 
    } 
} 
 
We have also attached the sample for your reference in the following link.  
 
In PlantesPage XAML file we have loaded PullToRefresh control and DataGrid as PullableContent 
 
Hope this will help you. 
 
Regards, 
Pradeep Kumar B 


Loader.
Live Chat Icon For mobile
Up arrow icon