DataTable or Similar one that can be used in WPF and Silverlight

Jan 12, 2009 at 4:00 PM
I'm looking for the way to create a class that can be used like a DataTable. I just want to have the dynamic rows and columns (no need to have AcceptChanges or Rollback or etc).. but that class should be able to bind with DataGrid. My requirement is that I want to show the Datagrid with dynamic columns. Instead of adding the DataGridColumn from Code-behind, I'm looking for a way that we can bind from View Model.

I have tested in WPF and I can use DataTable to fullfill that purpose but I need to do the same thing for Silverlight since we are sharing the ViewModel class in both WPF and Silverlight.


Jan 16, 2009 at 2:03 PM
Datasets dont work with Silverlight. Anything binds with a datagrid including arrays or collections of classes.

Linq for sql provides a realy easy to use table like interface ( except the rows are objects) so you get something like Table<Customer> . If you want to extend it just add the fields you need as properties.

You can always resort to string[] to represent rows.  Id be using arrays or collections of classes.