Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
how to set focus on last row in a data grid.

we can select last row of datagrid.

DG.SelectedIndex= DG.Items.Count-1;

but focus does't go on that row.

Need your kind Support.
Herman<T>.Instance 18-Jul-11 6:31am    
maybe this url ( gives you some help

1 solution

Usually I bind the grid to an object that implments ICollectionView[^]

This interface has a CurrentItem[^] and a CurrentPosition[^] property.

.Net provides BindingListCollectionView[^], ListCollectionView[^] and ItemCollection[^]

When you build your view model - expose collections as BindingListCollectionView or ListCollectionView - not as List<t> or BindingList<t>. This ensures that you can bind the "Current" element of a collection - something that makes sense in a view model.

Best regards
Espen Harlinn
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900