Pergunta

I have a Devexpress.XtraTreeList component. I want to catch in click event where the user is clicked on expand button or the node? How can I understand this?

Edit: Actually I am trying to do something like outlook using treelist. When I click the node, for example inbox, the messages in inbox are shown right side on the screen. When the user click another node, the treelist must be updated because some messages may be read. I did this functions in click event. It ıs OK. But in this case expand buttons functionality does not working normally.

Here is my problem

Foi útil?

Solução

I found the solution..

Thanks everyone..

private void treeList1_Click(object sender, System.EventArgs e) {
    DevExpress.XtraTreeList.TreeList tree = sender as DevExpress.XtraTreeList.TreeList;
    DevExpress.XtraTreeList.TreeListHitInfo info = tree.CalcHitInfo(tree.PointToClient(MousePosition));
    if(info.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell)
        ... // your code is here
}

Outras dicas

There is no event that fires when a Node is clicked. However, here are some other events that might interest you:

AfterExpand - Fires immediately after a Node has been expanded.

BeforeExpand - Fires before a Node is expanded.

FocusedNodeChanged - Fires immediately after changing the focused Node (which happens when the user selects a Node, regardless of whether they clicked on it or used an arrow key to get there).

I'll also note that DevExpress has their own knowledge base with examples and sample code. It would be a great place to start your research for future questions: http://www.devexpress.com/Support/Center/

    private void xtraTree_AfterFocusNode(object sender, NodeEventArgs e)
    {
    }

You can handle the above event on the XtraTreeList control and then extract the Node that was clicked on from the NodeEventArgs - e.Node

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top