This is a migrated thread and some comments may be shown as answers.

Prevent to scroll to the top of the Row

2 Answers 66 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ludovic
Top achievements
Rank 1
Ludovic asked on 07 Apr 2016, 03:11 PM
Hi,



I use a RadGridView and when I click on a GridViewRow which is not entire visible, I scroll automatically.

This is an illustration with the GridViewRow number 0, and the GridViewRow number 4, before and after a click.
http://image.noelshack.com/fichiers/2016/14/1460041764-telerik2.png
http://image.noelshack.com/fichiers/2016/14/1460041552-telerik3.png

When I click on it, the ScrollViewer is called. And I don't want ! But impossible to prevent this comportment. Could you help me ?



Thank you.

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 12 Apr 2016, 07:00 AM
Hello Ludovic,

I am afraid that there is no out-of-the-box mechanism for achieving this. You can check out this forum thread for more information, however, I cannot confirm that the workaround suggested in it would be working as expected in all scenarios.

All the best,
Stefan X1
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Ludovic
Top achievements
Rank 1
answered on 12 Apr 2016, 07:10 AM

Hi Stefan,

 

Your thread has solved my issue. Indeed, this code prevents the unwanted behavior

 

private void RadGridView_OnRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
{
    if ((e.OriginalSource as GridViewScrollViewer) != null)
    {
        var scrollViewer = this.RadGridView.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
        scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset);
    }
}

 

Thank you !

 

Regards,

Ludovic.

Tags
GridView
Asked by
Ludovic
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Ludovic
Top achievements
Rank 1
Share this question
or