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

2 posts, 0 answers
  1. Boardy
    Boardy avatar
    29 posts
    Member since:
    Mar 2010

    Posted 10 Mar 2014 Link to this post

    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 ]
  2. Yoan
    Admin
    Yoan avatar
    1215 posts

    Posted 13 Mar 2014 Link to this post

    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.

     
Back to Top