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

How to scroll row into view

6 Answers 182 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Harrigan
Top achievements
Rank 1
Richard Harrigan asked on 17 Jun 2011, 06:53 PM
Hi

 How would I ensure that a row is in view and if not in view how would I automatically scroll it into view.

Thanks
Rich

6 Answers, 1 is accepted

Sort by
0
Richard Harrigan
Top achievements
Rank 1
answered on 17 Jun 2011, 09:04 PM
Hi,

I found the reference to the ScrollIntoViewAsync method.  It did not work for me because it does not take into account that you may have a hierarchy since it looks at the root item collection.  How would I tell it to look at a child item collection and does the row index and column index relate to the child collection. 

I used 
    var rows = radGridDesignView.ChildrenOfType<GridViewRow>();
to get the collection of rows and I found the row I want to scroll to but the index is out of range.

 

 

Thanks
Rich

0
Rossen Hristov
Telerik team
answered on 20 Jun 2011, 08:45 AM
Hi Richard Harrigan,

ScrollIntoViewAsync works only with the top-level items. It cannot be used with hierarchical children. I am afraid that there is no functionality that will allow you to scroll a hierarchy child into view. There is no way to implement such a functionality, since in general you can have absolutely anything inside the hierarchy child template.

Greetings,
Ross
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
Ed
Top achievements
Rank 1
answered on 12 Jun 2012, 11:50 AM
Hi,

Would it be possible to implement this for "normal" child grids, though? I am a bit surprised that I can't do GridViewDataControl.ScrollIntoView(my selected item) on my child grids. There is nothing special about the grids, they were just added to the ChildTableDefinitions collection of the parent TableDefinition.

Thanks

Ed

0
Rossen Hristov
Telerik team
answered on 12 Jun 2012, 12:00 PM
Hi,

The XAML platform is lookless so anyone can change the HierarchyChildTemplate in any possible way. We can't be sure what will be inside. That is why we don't have a way to implement such a feature.

All the best,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Ed
Top achievements
Rank 1
answered on 12 Jun 2012, 12:08 PM
Hi,

Thanks. Given that in my case I do know what is inside the HierarchyChildTemplates (i.e. just more grids), is there a way that I could implement such a feature myself? Are the relevant objects exposed?

Thank you

Ed
0
Rossen Hristov
Telerik team
answered on 12 Jun 2012, 12:38 PM
Hi,

Since your grid's are nested (I don't know on how many levels), you can try to create a recursive method.

This method can do something like this:

1. Scroll a grid to a certain top-level item by using the ScrollIntoView family of methods.
2. Obtain a reference to the GridViewRow of this item by using the GetRowForItem method.
3. Once you have a reference to the GridViewRow, you can locate the child grid by using the ChildrenOfType<T> method.
4. Now you have a reference to the child grid and everything begins from point 1 recursively.

Of course each of your hierarchical items will need to know about its parent so you can build the recursive descent ladder of items.

Maybe something like this can do the job.

Regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Richard Harrigan
Top achievements
Rank 1
Answers by
Richard Harrigan
Top achievements
Rank 1
Rossen Hristov
Telerik team
Ed
Top achievements
Rank 1
Share this question
or