Virtual Tree Grid Sample and Column Headers

I''m trying to get a treecell to appear in the first column header so i can trap the click to expand all/collapse all (instead of the buttons).

I''ve altered GridQueryCellInfo in the following way, but the tree cell isn''t painting. Is this possible? Do i need to add another base style?

if (e.RowIndex == 0 && e.ColIndex == 1)
{
e.Style.CellValue = "Test";
e.Style.CellType = "TreeCell";
e.Style.Tag = 0;
e.Style.ImageIndex = 1;
}

Thanks,
Julie

2 Replies

AD Administrator Syncfusion Team August 19, 2006 07:55 AM UTC

Try this.

At the bottom of Form.Load, add:

// this.gridControl1[0, 1].BaseStyle = "Standard";
this.gridControl1[0, 1].Themed = false;
this.gridControl1[0, 1].CellType = "TreeCell";
this.gridControl1[0, 1].ImageIndex = 0;
this.gridControl1[0, 1].Tag = 0;
this.gridControl1[0, 1].ImageList = this.imageList1;
this.gridControl1.CellClick += new GridCellClickEventHandler(gridControl1_CellClick);


Then use this handler:

void gridControl1_CellClick(object sender, GridCellClickEventArgs e)
{
if (e.RowIndex == 0 && e.ColIndex == 1)
{
if(this.gridControl1[0, 1].ImageIndex == 0)
{
button4.PerformClick();
}
else
{
button5.PerformClick();
}
}
}


Then at the top of saveCellInfo, add

if (e.ColIndex == 1 && e.RowIndex == 0)
{
return;
}

This will just store the cell 0,1 information in the grid and let it be maintained internally, and not rely on the external datasource for its value.


JL Julie Levy August 23, 2006 11:58 PM UTC

Thanks for your help Clay, this works great.

Loader.
Up arrow icon