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

How to scroll a row to top after opening hierarchical childgrid

1 Answer 33 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Michael Gaigg
Top achievements
Rank 1
Michael Gaigg asked on 12 Oct 2012, 09:47 PM
I have a hierarchical GridView and a typical use case is to
- scroll down to the row I'm interested
- click the plus sign to open the child grid
- having to scroll further down in order to see the content of the child grid

What I want:
- Have the selected row scroll to the top of the currently visible area (showing the child grid content visible right below)

Any ideas?

I already tried the following:

- Using the current GridViewScrollViewer I ScrollToVerticalOffset(scrollViewer.VerticalOffset + scrollViewer.ViewportHeight) and then ScrollIntoView(this.ClickedRow) where ClickedRow is the actual parent row as determined by another click event; Result: doesn't scroll to parent row but to what appears to be the middle of the parent row + the parent row content (child grid)

- Calculating the height of all the rows prior to the currently selected and scrolling to index * (rows*rowHeight); Result: doesn't take into consideration any rows that are expanded (showing childgrids)

- A bunch of other things that all lead me down the wrong path

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 15 Oct 2012, 01:49 PM
Hello,

Indeed, the ScrollIntoView methods bring the item into view, but there is not a fixed position where the item will be brought. As the Silverlight layout system is asynchronous we cannot guarantee where exactly the row will be in the view. 

Unfortunately this is a limitation of the framework..


Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Michael Gaigg
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or