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

How to ScrollIntoView() a row of a child grid?

1 Answer 237 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Boardy
Top achievements
Rank 1
Veteran
Boardy asked on 10 Mar 2014, 12:35 PM
I have a grid with 2 subgrids. This hierachy is defined in the xaml with the ChildTableDefinitions property. The child grids have
grd.MaxHeight = double.PositiveInfinity;
in order to avoid a clutter of scrollbars. Also row virtualization has been turned off for as well the main grid as the child grids.

Now I'm implementing a refresh operation. During this, I want to reselect the item that was selected before the refresh was started (there is only one item selected in all these grids). I do this by expanding the appropriate rows until I reach the grid with the item to be selected. Then I set that grid's SelectedItem property.

So far so good. For obvious reasons I want to scroll the selected item back into view. When the selected row was in the main grid, I can just perform a
grd.ScrollIntoView(objSel);
But when I do this for a childgrid, nothing happens. I presume because the child grid doesn't have a scrollbar and as far as this grid is concerned, the selected row is in view. Also when I try
grdMain.ScrollIntoView(objSel);
nothing happens. I guess because objSel is not in the ItemsSource of the main grid (I didn't expect it to work, but I had to try). Also
grd.BringIntoView();
did not work out.

So I wonder what is a correct approach to scroll the selected item into view.

Thanks in advance,
   Herre

[ OS: W7; Telerik: WPF 2013.3.1316.40 ]

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 13 Mar 2014, 11:54 AM
Hi Herre,

Please check this forum thread where this question has already been discussed.

I hope it helps.

Regards,
Yoan
Telerik
 

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

 
Tags
GridView
Asked by
Boardy
Top achievements
Rank 1
Veteran
Answers by
Yoan
Telerik team
Share this question
or