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

ScrollViewer In RadGridView

3 Answers 423 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jeremy
Top achievements
Rank 1
jeremy asked on 03 Jun 2011, 08:11 AM
HI,
  Do RadGridView have ScrollToHorizontalOffset and ScrollToVerticalOffset  methods  likes  the ScrollViewer ?In my project, I use ScrollIntoView to take the row into view . The problem is when scroll the last item of RadGridView into view, it will scroll to the bottom of the view, I should take it to the top of the view. How to solver it.
Thanks a lot
Jeremy.

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 03 Jun 2011, 08:17 AM
Hi jeremy,

You can find the ScrollViewer using the ChildrenOfType<T> extension method and invoke the required methods:

var scrollViewer = this.radGridView.ChildrenOfType<GridViewScrollViewer>().FirstOrDefault();
//Get horizontal and vertical offsets
var horizontalOffset = scrollViewer.HorizontalOffset;
var verticalOffset = scrollViewer.VerticalOffset;
    
//Set horizontal and vertical offsets    
scrollViewer.ScrollToHorizontalOffset(horizontalOffset);
scrollViewer.ScrollToVerticalOffset(verticalOffset);
 

All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
jeremy
Top achievements
Rank 1
answered on 05 Jun 2011, 03:35 PM
Hi Maya,
    Thanks a lot. From your code,  I get a summary that one control includes some sub controls, like the gridview include the scrollviewer, developers can user ChildrenTypeOf<> function to find the child control which do you want, is it right? thanks agagin.

Kind Regards
Jeremy.
0
Maya
Telerik team
answered on 06 Jun 2011, 06:54 AM
Hello jeremy,

Indeed, you may use the extension method to get all the children controls of specific belonging to another control. Still, you may benefit from the ParentOfType<T> method as well. You may take a look at this blog post for a reference.
    

Best wishes,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
jeremy
Top achievements
Rank 1
Answers by
Maya
Telerik team
jeremy
Top achievements
Rank 1
Share this question
or