Scrolling of DataGrid

Hi,

I wonder if anyone have a solution for my problem.

I'm developing a software that has a list longer than can fit on screen.

I would like to display this in a DataGrid and have the display to automatically slide up and down over time. The list will flow up and down in order to show all values without any user interaction.

The goal is to create a dynamic presentation of this list flowing up and down!

I hope my explanation was clear enough :-).

Regards,

3 Replies

JG Jai Ganesh S Syncfusion Team February 23, 2018 01:16 PM UTC

We suspect that, you want to scroll the datagrid rows programmatically without any user interaction. You can achieve this by using the below code, 
async private void ScrollDown_Click(object sender, RoutedEventArgs e) 
{ 
    for (int i = 0; i <= this.datagrid.View.Records.Count; i++) 
    { 
        this.datagrid.ScrollInView(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(i,0)); 
        await Task.Delay(100); 
    } 
} 
 
async private void ScrollUp_Click(object sender, RoutedEventArgs e) 
{ 
    for(int i= this.datagrid.View.Records.Count;i>0;i--) 
    { 
        await Task.Delay(100); 
        this.datagrid.ScrollInView(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(i, 0)); 
    } 
} 
 
If the above one is not your requirement then please share the more information about your query. This would be more helpful for us to proceed further. 
Regards, 
Jai Ganesh S 



MA Martin February 23, 2018 04:32 PM UTC

Thank's for your very Quick reply. In you sample I can't see I nice smooth scrolling.

However the example is a good start! But I would like to have one button only to start scrolling, first up and the down and the up again and so forth........ And the scrolling need to be smooth.

It will be used to present results during a dirtbikerace for the spectators. Hence it needs to be smooth! The data is dynamic (no more rows but new columns with new results)

Regards,


MK Muthukumar Kalyanasundaram Syncfusion Team February 26, 2018 06:44 PM UTC

Hi Martin, 
 
Thanks for the update. 
 
Based on your requirement, we have modified the sample. When you select the ScrollUpandDown button at first time, it will scroll up and second time it scroll down and so on.  Please refer the attached sample in the below location, 
 
Code Snippet: 
 
async private void ScrollDown_Click(object sender, RoutedEventArgs e) 
{ 
    //Scroll up 
    if (clickCount %2 == 0) 
    { 
        for (int i = 0; i <= this.datagrid.View.Records.Count; i++) 
        { 
            this.datagrid.ScrollInView(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(i, 0)); 
            await Task.Delay(100); 
        } 
        clickCount++; 
    } 
    Else //Scroll down 
    { 
        for (int i = this.datagrid.View.Records.Count; i > 0; i--) 
        { 
            await Task.Delay(100); 
            this.datagrid.ScrollInView(new Syncfusion.UI.Xaml.ScrollAxis.RowColumnIndex(i, 0));                     
        } 
        clickCount--; 
    } 
} 



Please let us know if you have any concerns. 

Regards, 
Muthukumar K 


Loader.
Up arrow icon