简体   繁体   中英

When I click on a treelist, I want a word to appear in a textbox with devExpress

When I click on a word in my treelist, I want another word to appear in my textbox. I know I need the click event method, but am not sure how to implement that. I am using DevExpress and Visual Studios.

In my treelist, for example I have the options: "print" and "highlight". If I select the "print" option, I want the word "hello" to appear in the textbox.

You can take a look at the TreeList.FocusedNodeChanged Event :

First you have to Hook up to an event to your TreeList. You can do this via the Designer or manually like:

treeList1.FocusedNodeChanged += new DevExpress.XtraTreeList.FocusedNodeChangedEventHandler(this.treeList1_FocusedNodeChanged);

Create the corresponding method, which will be triggered every time the focused node in your TreeList got changed:

private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e)
{
        textBox1.Text = e.Node.GetDisplayText(treeListColumn1); //set you text here
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM