Hi
I have an UltraTree (v12.2).
The ViewStyle is set to OutlookExpress to be able to get all the columns from the different levels properly aligned.
One of the column is a checkbox but I need to display the CheckBox only on rows of the first level (other level can leave the cell empty).
How can I achieve that?
Hi,
I don't think this is possible in OutlookExpress mode, because all of the levels have the same set of display columns. I think you might be able to hide the checkboxes and just show an empty cell on all of the child nodes, but I don't believe it's possible to remove the space.
An empty cell would be fine with me. How can I do it?
That depends. I assuming your tree is bound to a data source, and that you are showing a CheckBox in the cell by setting the Editor property of the column to a CheckEditor. If that's the case, you could change the editor on the child node cells to an image renderer.
private EmbeddableImageRenderer embeddableImageRenderer = new EmbeddableImageRenderer(); private void ultraTree1_InitializeDataNode(object sender, Infragistics.Win.UltraWinTree.InitializeDataNodeEventArgs e) { if (null != e.Node.Parent) { e.Node.Cells["Boolean 1"].Editor = embeddableImageRenderer; } }
This is kind've a hack. Basically, you are telling the cell to display as an image, and since the boolean value in the cell cannot be converted into an image, it shows a blank. It also makes it so the user cannot edit the cell, so it works pretty well.
If this doesn't work because one of my assumptions is wrong, then the next best thing would be to use a CreationFilter to prevent the cell from creating the CheckBox elements.
my tree is not bound. If I am not mistaken, the InitializeDataNode won't be triggered.
What would be the method for an unbound tree?
It seems that it does the job! Thanks again
Hm, maybe those are leftover checkbox elements that are not getting removed. Right before you return true from the CreationFilter, add this:
parent.ChildElements.Clear();
Let me know if that doesn't help.
Any ideas why I sometimes see some ghost?
As shown on the attached image, only the purple line (level 0) should show a checkbox.
The ghosts appear here and there not always and the same place, sometimes after I do a ExpandAll, sometime when scrolling, ...
The CreationFilter does the trick. Thanks.
I just checked again and I don't have an editor. Here is my code (referencing v.12.2):
//set the ColumnSet UltraTreeColumnSet rootColumnSet = treeHeaders.ColumnSettings.RootColumnSet; rootColumnSet.AllowCellEdit = AllowCellEdit.Full; _columnSelected = rootColumnSet.Columns.Add("Selected"); _columnSelected.DataType = typeof (bool); _columnSelected.AllowCellEdit = AllowCellEdit.Full; _columnSelected.ButtonDisplayStyle = ButtonDisplayStyle.Always;
Really? If I don't assign a CheckEditor to the column, it displays as "true" or "false" on mine.
Anyway, no - it doesn't matter whether you use an editor or not.