Hi Adnan,
Question 1: create the collapsible datasource for product object
To display the product object in a virtualtree grid, you neeed to populate a CollapsibleDataSource.data for product object using the below code. Here is a sample which populates the CollapsibleDataSource.data with a prodcute object. Please refer to the attached sample for more details.
Sample :
ModifiedTesting2.zippublic void InitFromProduct(Product product)
{
int rows = product.childProducts.Count;
int cols = 0;
this.data = new SampleData[rows + 2];
cols = product.GetType().GetFields().Length;
int ncols = TypeDescriptor.GetProperties(product.childProducts).Count ;
if (cols < ncols)
cols = ncols;
int row = 0;
///For product name datatable.
string[] s = new string[cols];
s[0] = product.ToString();
data[row] = new SampleData(0, TreeNodeState.NoChildren, s);
//product object items...
s = new string[cols];
s[0] = product.ProductName;
s[1] = product.ProductDescription;
row++;
data[row] = new SampleData(1, TreeNodeState.NoChildren, s);
//childproduct item.
foreach (Product item in product.childProducts)
{
row++;
s = new string[cols];
s[0] = item.ProductName;
s[1] = item.ProductDescription;
data[row] = new SampleData(2, TreeNodeState.NoChildren, s);
}
internalColCount = cols;
Locked = false;
internalRowCount = rows;
visibleRows = new ArrayList();
}
Question 2: Is there any way to expand columns?
>>>>>
Here is a forum thread that discuss with the excel like grouping( Expanding/Collapshing the columns) in a grid.
http://www.syncfusion.com/support/forums/message.aspx?MessageID=32554>>>>>
Best Regards,
Haneef