views:

707

answers:

1

I am using DataGrid from the WPF Toolkit and I need to be able to maintain focus on the bottom of the grid (i.e. the last row). The problem I'm having right now is that as rows are added the scrollbar for the DataGrid doesn't scroll along with the new rows being added. What's the best way to accomplish this?

+2  A: 

Looks like DataGrid.ScrollIntoView(<item>) will keep the focus on the bottom of the DataGrid.

Taylor Leese
Where do you call this method?
joe
it does. Just make a call after you have updated your datasource with the new element.Be sure to call UpdateLayout() before ScrollIntoView though!
Vinzz
Why do you need to call UpdateLayout() first? I didn't have to do that. Is it just a best practice for some reason?
Taylor Leese