I am populating tree nodes dynamically, and am setting the Node LeftImages based on certain conditions within the application. I am unable to make those images appear in the tree. I have attached a sample project which shows the issue. Below is the method where those images are being added to the collection. Any input or assistance on why this is not working for me would be greatly appreciated. I am using NetAdvantage 20083.2115.
-Justin
private void PopulateTree(NodeType nodeType, Condition condition) {
UltraTreeNode aNode;
aNode = new Infragistics.Win.UltraWinTree.UltraTreeNode();
if (NodeType.NodeType1 == nodeType) {
aNode.Override.ColumnSet = this.ultraTree1.ColumnSettings.ColumnSets["ColumnSet1"];
aNode.Cells["Column 1"].Value = "Col1";
aNode.Cells["Column 2"].Value = "Col2";
} else if (NodeType.NodeType2 == nodeType) {
aNode.Override.ColumnSet = this.ultraTree1.ColumnSettings.ColumnSets["ColumnSet2"];
aNode.Cells["Column 3"].Value = "Col3";
aNode.Cells["Column 4"].Value = "Col4";
}
switch (condition) {
case Condition.Fail:
aNode.LeftImages.Add(Properties.Resources.Error_16x16);
break;
case Condition.Pass:
aNode.LeftImages.Add(Properties.Resources.Check_16x16);
// this is going to be the root node
if (this.ultraTree1.SelectedNodes.Count == 0) {
//Clear all the tree nodes (just in case the tree was loaded already)
this.ultraTree1.Nodes.Clear();
this.ultraTree1.Nodes.Add(aNode);
} else {
//ParentRow is not nothing, so load a level other than the root
foreach (UltraTreeNode node in this.ultraTree1.SelectedNodes) {
node.Nodes.Add(aNode);
this.ultraTree1.ExpandAll();
// autosize all columns
foreach (UltraTreeColumnSet columnSet in this.ultraTree1.ColumnSettings.ColumnSets) {
foreach (UltraTreeNodeColumn column in columnSet.Columns) {
column.PerformAutoResize(ColumnAutoSizeMode.AllNodesWithDescendants);
Okay so I came up with a solution even though it isn't the one I was looking for. I created a new column in each ColumnSet and am setting that columns LayoutInfo.LabelPosition to None, and the DataType to System.Drawing.Bitmap. In my code I'm assigning the Image with this:
aNode.Cells[
"Condition"].Appearance.Image = Properties.Resources.Warning_16x16;
I don't really like this solution because my root node should not have any image, and now I'm stuck with either an empty cell, or I have to hide that cell at run time. It would have been nicer if LeftImages would just show up no matter what the ViewStyle or ShowColumns settings are set as.