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?
views:
707answers:
1
+2
A:
Looks like DataGrid.ScrollIntoView(<item>)
will keep the focus on the bottom of the DataGrid
.
Taylor Leese
2009-08-18 22:44:42
Where do you call this method?
joe
2010-01-29 14:37:32
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
2010-01-29 14:40:48
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
2010-01-29 20:01:15