ScrollIntoView() can not get the right Row into viewable area.

Jan 9, 2009 at 3:52 AM
Hi,Friends,  I have  thousands of pages data in DataGrid. and I need to call ScrollIntoView() to scroll to a certain row. But it does not work for me. Below
is my code.
                int pos =  theGrid.Items.Count -2;
                DataGridRow row = theGrid.Items(pos);
                theGrid.SelectedItem = row;

Is there something wrong in my code?  How can I achieve this on DataGrid.

Jan 13, 2009 at 6:21 AM
Well, for one thing (assuming that this is C#), it shouldn't even compile, because ItemsControl.Items is a collection and not a method.
Jan 13, 2009 at 12:05 PM
Also, theGrid.Items[pos] will return a data item and not a DataGridRow.