Show Collection of Collection

Aug 29, 2008 at 3:12 PM
How can we use DataGrid to show collection of data stored in Collection of objects ?
For example:

public class Variable
{
private List<int> values=new List<int>();
public List<int> Values
{
get{return(values);}
set{values=value;}
}
}

how can use DataGrid to present data stored in Collection of  Variable objects ???!!
Coordinator
Aug 29, 2008 at 7:30 PM
How exactly do you want Values to be represented in the DataGrid?  You have a list of Variable objects which I'm assuming will be the rows of the DataGrid.  If you want each int in Values to be equivalent to the cells then you can setup columns with DataFieldBinding = Values[x].
Sep 7, 2008 at 7:14 PM
The list of variable objects are the rows of datagrid, but number of columns(list of values) are different for each rows.
User want to add values(columns) using Datagrid, but rows has different Values(different number of columns).
Is there any way to use datagrid like Spreadsheets(example worksheets in Excel) and do all bindings automatically.


Coordinator
Sep 8, 2008 at 3:56 PM
Each row in a single DataGrid will always have the same number of columns.  It is similar to a ListView. 

For your scenario you can display different values in each cell but the total number of cells displayed in a row will always be the same number.