I have an UltraTree (v 7.3) component on a windows form (VS 2005) that is bound to a .NET class with three properties (two string values and a boolean value).
The class structure is as follows:public class TreeHierarchy : List<HierarchyItem>{}public class HierarchyItem{}HierarcyItem contains the three properties Name(string), Type(string), Check(bool); and two methods: public List<HierarchyItem> Child, public void AddChild(HierarchyItem hierarchyItem)
I populate the above classes as follows, and bind them to the ultraTree in the form load event...TreeHierarchy treeHierarchy = new TreeHierarchy();HierarchyItem hi = new HierarchyItem("A", "", true);treeHierarchy.Add(hi);hi.AddChild(new HierarchyItem("the quick brown fox", "Add", false));hi.AddChild(new HierarchyItem("2", "Add", false));
hi = new HierarchyItem("B", "Delete", true);treeHierarchy.Add(hi);hi.AddChild(new HierarchyItem("1", "Delete", false));hi.AddChild(new HierarchyItem("2", "Add", true));
ultraTree1.DataSource = treeHierarchy;
The following is achieved when the ColumnSetGenerated event is fired...The "Type" property is bound to a valueList and displays images (Using the valueList.DisplayStyle = ValueListDisplayStyle.Picture; code).The Check property is shown as a checkbox and is set to AllowCellEdit.Full.
The question that I have is...
Is it possible to have the checkbox show for some levels in the tree hierarchy but not in others?
Ys it is possible. My tree does this in fact in OutLook mode, so I assume it is possible in other modes. What you need todo is not configure the column, but configure the cell instead.
In my case I do this:
private UltraCheckEditor ultraCheckEditor = new UltraCheckEditor();
//
// Setup required override editor
node.Cells["Override Required"].EditorControl = ultraCheckEditor;
I'm not sure why tribbles (above) is setting AllowEdit. But basically, what you would have to do is set the Editor or EditorControl on each cell. So you could set some of them to an UltraCheckEditor and some to someething else. Regarding the something else, if you just want the cell to appear blank, I recommend using an UltraPictureBox as the editor, since it will be blank with no image and it does not allow editing. So it will give you a nice clean blank cell.
Note that you do not have to create a new control for each cell. You can create one UltraCheckEditor and one UltraPictureBox and then just assign the same one to as many cells as you need.
I have some columns that don't show a checkbox, some that show a checkbox and allow editing and some that show a check box and don't allow editing... The create control snippet is from the constructor of my editor... Imy my exampleI have a tree that shows a database record, it's columns and foreign keys. I don't show a checkbox on the record, I show a checkbox for all columns and only allow editing of the required for a column if it is not already required. i.e. Any choices you max can only be more restrictive than the database, not less...
Setting the disables is actually important to make the checkbox look visually different. By default it is read only. It looks editable, but actually isn't and makes it very hard to determine which checkboxes you can actually change and which ones you can't.
As for the picturebox idea... I found the more controls you add, the less performant the control is and the less smooth the scroll is. I see no visual different between no control assignment and the assignment of the blank picturebox...