AutoScroll in a DataGrid
This post will address how to AutoScroll to a specific object (row) in the DataGrid and select it. gridContactsList is of type Microsoft.Windows.Controls.DataGrid This is a great way of automatically selecting the newest inserted row in the Grid. Once you know the index of the newly created object and you have added it to the Grid, use the following two lines to AutoScroll and select the row: gridContactsList.UpdateLayout(); gridContactsList.ScrollIntoView(gridContactsList.Items[index1]); The method gridContactsList.ScrollIntoView(...) accepts the object that needs to be selected. This method also has an oeverload that takes the object to be selected and the column. The most important thing to notice about the AutoScroll and selection is that You have to call the gridContactsList.UpdateLayout(); method before using the ScrollIntoView method. Not doing so will throw a null reference even if the object reference is valid.











