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

how to control flinging on vertical scrolling?

I am using images in each row that are downloaded from aws s3 bucket, when user scroll super fast (flings) it freezes the app. 
On XF listview, it is suggested to use ScrollStateChanged event as shown below. Is there something similar on sfdatagrid?

_myListView.ScrollStateChanged += (object sender, ScrollStateChangedEventArgs scrollArgs) => {
  switch (scrollArgs.ScrollState)
  {
    case ScrollState.Fling:
      ImageService.Instance.SetPauseWork(true); // all image loading requests will be silently canceled
      break;
    case ScrollState.Idle:
      ImageService.Instance.SetPauseWork(false); // loading requests are allowed again
      
      // Here you should have your custom method that forces redrawing visible list items
      _myListView.ForcePdfThumbnailsRedraw();
      break;
  }
};

1 Reply

SS Suhasini  Suresh Syncfusion Team April 19, 2017 12:58 PM UTC

Hi Emil, 
 
Thanks for contacting Syncfusion Support. 
 
You can load images to the column using SfDataGrid.GridImageColumn, we have prepared the sample to achieve your requirement and you can download the same from the below link. 
 
 
Note: In the sample provided, we have referred 14.3.0.49 custom assemblies of SfDataGrid. You can update the custom assemblies by using the Syncfusion nugets if you need. 
 
Please refer the below UG link for more details about the column types in SfDataGrid. 
 
 
Regarding Scrolling event query: 
 
At present, SfDataGrid does not have any Scrolling event. However, you can achieve this requirement using our internal ScrollChanged event as below.  
 
Please refer the below code example for more details. 
 
dataGrid.GridLoaded += DataGrid_GridLoaded; 
 
private void DataGrid_GridLoaded(object sender, GridLoadedEventArgs e) 
{ 
    var container = dataGrid.GetType().GetTypeInfo().GetDeclaredProperty("VisualContainer").GetValue(dataGrid) as VisualContainer; 
    container.ScrollRows.Changed += ScrollRows_Changed; 
} 
 
private void ScrollRows_Changed(object sender, ScrollChangedEventArgs e) 
{ 
    // Will be called when the SfDataGrid is scrolled 
} 
 
 
Regards, 
Suhasini 


Loader.
Up arrow icon