Hi!
Is there a possibility to find out the actual scroll position of the GridView? The matter is that I rebind the datasource und therefore the Grid looses the actual scroll position and jumps to the first item.
I experienced a bit with ScrollViewer and ScrollContentPresenter but couldnt find a solution!
Greetings
Philip
Is there a possibility to find out the actual scroll position of the GridView? The matter is that I rebind the datasource und therefore the Grid looses the actual scroll position and jumps to the first item.
I experienced a bit with ScrollViewer and ScrollContentPresenter but couldnt find a solution!
Greetings
Philip
7 Answers, 1 is accepted
0
Ваня
Top achievements
Rank 1
answered on 10 Jul 2010, 10:29 AM
Hi,Philip
See the following thread I think that it could be useful for you:
http://www.telerik.com/community/forums/silverlight/gridview/get-scrollbar-position-and-then-set-it.aspx
Regards,Vanya
See the following thread I think that it could be useful for you:
http://www.telerik.com/community/forums/silverlight/gridview/get-scrollbar-position-and-then-set-it.aspx
Regards,Vanya
0
Aryn
Top achievements
Rank 1
answered on 15 Nov 2014, 08:21 PM
The thread has a link to a disabled page. Can you please provide another example? Thank you!
0
Hello Aryn,
Thank you for contacting us.
This forum post referrs to the following blog post "How To: Custom scrolling with RadGridView for Silverlight and WCF RIA Services".
For WPF you could take a look at the following post.
Are you looking for something similar?
Regards,
Vanya Pavlova
Telerik
Thank you for contacting us.
This forum post referrs to the following blog post "How To: Custom scrolling with RadGridView for Silverlight and WCF RIA Services".
For WPF you could take a look at the following post.
Are you looking for something similar?
Regards,
Vanya Pavlova
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Aryn
Top achievements
Rank 1
answered on 17 Nov 2014, 03:48 PM
The WPF post (you posted) led me to the silverlight one. Unfortunately, I cannot do what the WPF user did. I must rebind my data set. I have tried very hard to read the scroll bar position and reset it but it seems to only do this accurately when I am debugging. Otherwise it jumps randomly all over my 2000 + record set uncontrollably.
The code I used was:
var scrollViewer = this.GridView.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
//Get horizontal and vertical offsets
var horizontalOffset = scrollViewer.HorizontalOffset;
var verticalOffset = scrollViewer.VerticalOffset;
//do edit and rebind
LoadTablesAndGrid();
//Set horizontal and vertical offsets
scrollViewer.ScrollToHorizontalOffset(horizontalOffset);
scrollViewer.ScrollToVerticalOffset(verticalOffset);
The code I used was:
var scrollViewer = this.GridView.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
//Get horizontal and vertical offsets
var horizontalOffset = scrollViewer.HorizontalOffset;
var verticalOffset = scrollViewer.VerticalOffset;
//do edit and rebind
LoadTablesAndGrid();
//Set horizontal and vertical offsets
scrollViewer.ScrollToHorizontalOffset(horizontalOffset);
scrollViewer.ScrollToVerticalOffset(verticalOffset);
0
Hello Phillip,
I believe that the following forum thread "RadGridView scroll position reset after Rebind()" might be of help on that matter.
Regards,
Vanya Pavlova
Telerik
I believe that the following forum thread "RadGridView scroll position reset after Rebind()" might be of help on that matter.
Regards,
Vanya Pavlova
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Aryn
Top achievements
Rank 1
answered on 20 Nov 2014, 04:18 PM
Phillip,
Thanks for the suggested post but if you notice that is exactly what I tried. When I do that it works when I am debugging otherwise it throws me all over my 2000+ records. I have found a hack solution that will get me by that hacks the ScrollIntoView but unfortunately it looks to me that you cannot reliably rely on the ScrollViewer to return you to your same location in the grid.
Thanks,
Aryn
Thanks for the suggested post but if you notice that is exactly what I tried. When I do that it works when I am debugging otherwise it throws me all over my 2000+ records. I have found a hack solution that will get me by that hacks the ScrollIntoView but unfortunately it looks to me that you cannot reliably rely on the ScrollViewer to return you to your same location in the grid.
Thanks,
Aryn
0
Hi,
You can try saving the state of the ScrollViewer (VerticalOffset) and apply it after you have called Rebind().
For example:
You can also check this forum thread where this question has already been discussed.
Does this result in an uncontrollable scroll behavior?
Regards,
Dimitrina
Telerik
You can try saving the state of the ScrollViewer (VerticalOffset) and apply it after you have called Rebind().
For example:
scrollViewer =
this
.clubsGrid.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
var verticalOffset = scrollViewer.VerticalOffset;
//reset of the itemssource
//Set vertical offset back
...
You can also check this forum thread where this question has already been discussed.
Does this result in an uncontrollable scroll behavior?
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.