Below is the code behind in my view model:
private DataRow selectedErrorRow;
public DataRow SelectedErrorRow
{
get { return selectedErrorRow; }
set { selectedErrorRow = value; base.RaisePropertyChanged("SelectedErrorRow"); }
}
Then this in my view:
<DataGrid SelectedItem="{Binding SelectedErrorRow,Mode=TwoWay}"
The binding somewhat works… It “gets” the value when the datagrid is drawn but it never sets it when a new value is selected/highlighted…. Any ideas?
Note the item source for the datagrid is a DataTable.
EDIT:
The Datagrid is in a PopUp, when the datagrid gets drawn it will get the binded value (null). However once I selected/highlight a row it will NOT ‘set’ anything. It will however ‘set’ the binded value null when its redrawn (the popup is open, i selected a row, close it,and reopen it). The thing is It never sets the value to anything but null, and it only sets it during the secound time its drawn.
I needed to change what I was binding to. It needs to bind to a
DataRowViewand not aDataRow.