The current version of the TreeList doesn't support bands. This example demonstrates how you can merge column headers to create an effect of bands.
Question Comments
Added By: (no info) at: 4/5/2013 3:46:56 PM
Where is TreeListHeaderMerger method defined?
Added By: Sarath Kumar Munikrishnan at: 6/18/2015 12:31:16 AMHI I need to merge Columns also. Not the header. I used following code change in the below code
public class TreeListHeaderMerger
{
private TreeList treeList;
private TreeListColumn columnToMerge;
public TreeListHeaderMerger(TreeList treeList, TreeListColumn columnToMerge)
{
this.treeList = treeList;
this.columnToMerge = columnToMerge;
columnToMerge.OptionsColumn.AllowMove = false;
GetNextColumn().OptionsColumn.AllowMove = false;
treeList.CustomDrawColumnHeader += treeList_CustomDrawColumnHeader;
treeList.CustomDrawNodeCell += treeList_CustomDrawNodeCell;
}
void treeList_CustomDrawNodeCell(object sender, CustomDrawNodeCellEventArgs e)
{
TreeListColumn nextColumn = GetNextColumn();
if (nextColumn == null) return;
if (e.Column == nextColumn) { e.Handled = true; return; }
if (e.Column != columnToMerge) return;
Rectangle r = e.ObjectArgs.Bounds;
r.Width = r.Width + nextColumn.VisibleWidth;
e.ObjectArgs.Bounds = r;
}
TreeListColumn GetNextColumn()
{
if (columnToMerge.VisibleIndex == treeList.Columns.Count - 1) return null;
return treeList.Columns[columnToMerge.VisibleIndex + 1];
}
void treeList_CustomDrawColumnHeader(object sender, CustomDrawColumnHeaderEventArgs e)
{
TreeListColumn nextColumn = GetNextColumn();
if (nextColumn == null) return;
if (e.Column == nextColumn) { e.Handled = true; return; }
if (e.Column != columnToMerge) return;
Rectangle r = e.ObjectArgs.Bounds;
r.Width = r.Width + nextColumn.VisibleWidth;
e.ObjectArgs.Bounds = r;
}
}
But I can't able to merge columns Its hiding second column value but not the border. Once I clicking the specific field I'm able to view the data also. Am I missing any thing?
Added By: Alisher (DevExpress Support) at: 6/18/2015 1:03:34 AM Hi,I will reply you in the Merge two columns in treeList ticket. Please refer to it for further correspondence.