Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF DataGrid Binding to CurrentItem or SelectedItem?

If I have a DataGrid in my View and a Property in my ViewModel that represents currently active DataGridRow (e.g. focused item or clicked item) should I bind my Property to SelectedItem or CurrentItem. Say I chose to bind it to SelectedItem, then What's CurrentItem for? should I bind another Property to CurrentItem?

like image 216
samaneh Avatar asked May 22 '15 11:05

samaneh


1 Answers

Look at this: DataGrid CurrentItem != SelectedItem after reentry with tab-button

First of all a row is selected by the user which makes the datagrid show that row in the selected way (SelectedItem and also CurrentItem contain the selected object). Then the focus is given to another control. In this status - the selection is still shown - SelectedItem is still there while CurrentItem is null!

Good article: http://docs.telerik.com/devtools/silverlight/controls/radgridview/selection/selecteditem-currentitem.html

like image 199
KeyTrap Avatar answered Sep 27 '22 20:09

KeyTrap