tags:

views:

31

answers:

1

I have a dynamic set of columns and when I populate the rows and know only the columnname of the rows. Is that possible to do?

A list of columns:
Columns[0] = "firstcol";
Columns[12] = "anothercol";

And a list of rows.
First row
Rows[0][0] = "item";
Rows[0][12] = "item";

Second row
Rows[1][0] = "item";
Rows[1][12] = "item";

I need to populate the datagrid. Can that be done, with a dictionary or something, as I do not know the columns...

A: 

If you can manage to create a structure, - Row - Column Header - Cell Data

Also expose the List of column to your control (maybe bind it) then on update of it dynamically create columns and attach cell template, cell edit template (data templates, where you specify the binding with the source item and paths). This way your dynamic columns will be added and binding will be established thus any changes in the rows or the data will be updated between your 'presenter' and 'view' (wpf datagrid control)

bjoshi