SfDataGrid Pan Event

Is there an event that fires when a grid pan event starts? 

1 Reply

JA Jayaraman Ayyanar Syncfusion Team May 7, 2018 11:48 AM UTC

Hi  Todd, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your query for “SfDataGrid pan event”. At present, we do not have any panning event in SfDataGrid that triggers when scrolling. However, you can work around it by hooking the ScrollRows.Changed event which will be fired whenever you scroll the grid. 
 
Refer the below code snippets to achieve your requirement 
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 vertically.  
}  
 
 
The above will be hit whenever the grid is scrolled vertically. If you may require to get notified when scrolled horizontally too, then hook the container.ScrollColumns.Changed event also. 
 
We have prepared a sample for your requirement and you can download the same from the below location. 
 
Regards, 
Jayaraman. 


Loader.
Up arrow icon