如何在UltraTreeNode集合中添加自定义属性?使用UltraTree Infragistics控件12.x版本。
例如:
UltraTree MyUltraTree = new UltraTree();
UltraTreeNode MyNode = new UltraTreeNode();
MyNode.Text = "Caption of My Node";
MyNode.MyCustomProperty = "This is custom property want to Add in Node Collection";
MyUltraTree.Nodes.Add(MyNode);
答案 0 :(得分:0)
正如斯图亚德所写,您可以像这样继承UltraTreeNode
:
public class CustomUltraTreeNode: UltraTreeNode
{
public string MyCustomPorperty { get; set; }
public string SomeOtherCustomProperty { get; set; }
}
然后您可以像这样使用CustomUltraTreeNode
代替UltraTreeNode
:
UltraTree MyUltraTree = new UltraTree();
CustomUltraTreeNode MyNode = new CustomUltraTreeNode();
MyNode.Text = "Caption of My Node";
MyNode.MyCustomPorperty = "This is custom property want to Add in Node Collection";
MyNode.SomeOtherCustomProperty = "This is some other custom property";
MyUltraTree.Nodes.Add(MyNode);