|
DevExpress.XtraTreeList.Nodes.TreeListNode TN;
//Traversal search
public void GetNode(DevExpress.XtraTreeList.Nodes.TreeListNodes tc, string pSelected)
{
foreach (DevExpress.XtraTreeList.Nodes.TreeListNode TNode in tc)
{
if (TNode.GetValue(this.treeList1.KeyFieldName).ToString() == pSelected)
{
TN = TNode;
}
if (TNode.GetValue("OrganizeName").ToString() == pSelected)
{
TN = TNode;
}
GetNode(TNode.Nodes, pSelected);
}
}
private void button1_Click(object sender, EventArgs e)
{
GetNode(this.treeList1.Nodes, this.textBox1.Text);
if (TN != null)
{
//Set focus
this.treeList1.SetFocusedNode(TN);
}
}
private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
{
DevExpress.XtraTreeList.TreeListMultiSelection mMSTN = this.treeList1.Selection;
for (int i = 0; i <mMSTN.Count; i++)
{
this.textBox1.Text = mMSTN[i][this.treeList1.KeyFieldName].ToString() + ":" + mMSTN[i][this.treeList1.ParentFieldName].ToString();
}
} |
|