I was wondering if there is a way to have the grid automatically scroll to the bottom when new items are added to the ObservableCollection that is bound to the ItemsSource. Basically I want to ensure that the newest item is visible as it is added.
Cheers,
Clint
2 Answers, 1 is accepted
0
Accepted
Veselin Vasilev
Telerik team
answered on 15 Oct 2010, 08:54 AM
Hi Clint Singer,
I have just created a how-to article on this topic. It will go live next week. Here is its content:
This article shows how to scroll RadGridView to a particular row and / or column.
We will use the ScrollIntoViewAsync method against a grid with many rows and columns.
The ScrollIntoViewAsync method accepts the following parameters:
DataItem of type Object - here you pass the business object you want to scroll to.
[optional] Column of type GridViewColumn - here you pass the GridViewColumn you want to scroll to
CallBack method - it will be called when the method succeeds
Here is the code that will scroll into the last row and last column of the gridview:
(f asGridViewRow).IsSelected = true; // the callback method
}));
You should use this method when the virtualization is turned on (which is by default). If for some reason you have disabled the virtualization - you can use the ScrollIntoView counterpart. The only difference in terms of programming API is that no callback method is called when the ScrollIntoView succeeds.
Hope this helps.
Sincerely yours,
Veselin Vasilev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
Thanks for the sample. I would like to make feature request to add an Autoscroll feature to the grid. If Autoscroll is on then the grid will scroll to the bottom of the grid or new item. When someone uses the scrollbar it disables the autoscroll feature until the scrollbar is scrolled to the bottom, reenabling the autoscroll.
Or some mechanism to support that type of scenario as I would think it is a fairly common requirement.