Hi all,
I have a class that contains data from some model. This class has metadata along with the actual value.
class ServerValue {
public int SomeId {get;}
public int SomeOtherId {get;}
public DateTime LastChanged {get;}
public object Value {get;set;}
// this lets me show the value, but how do i update it from the grid?
public override string ToString(){
return Value.ToString();
}
}
Now I also have a class MyDataTable that derives from DataTable that has all kind of logic. It calls the server, gets a bunch of ServerValues and puts them into Rows and Columns.
Finally I have a WPF DataGrid that I bind to the MyDataTable and the data are displayed, because the DataGrid calls ToString on each ServerValue and gets back the value for display. Hurray so far.
Now, I want to have two way databinding, so input on the grid is written back to the ServerValue. So I want to bind the grid cells to the Value property of the ServerValue instead of the ServerValue itself.
Right now the ServerValue of the DataGrid cell is just replaced with a string. I could work around this and all but I'd to try the elegant route first.
So I have a datatable with a complex type in cells and i want two-way databinding to a specific property of that type.
Is this possible? I've been googling on this and i can't anything on this.
Thanks in advance,
John