| |

VerySource

 Forgot password?
 Register
Search
View: 837|Reply: 1

How to locate XtraTreeList?

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-28 13:00:01
| Show all posts |Read mode
I used DevExpress's XtraTreeList, and now I must make a row positioning selection based on the data that can mark a row in it. How to achieve
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-29 15:00:03
| Show all posts
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();
    }
}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list