Skip to main content
A newer version of this page is available. .

TreeList.FocusedNodeChanged Event

Fires immediately after changing the focused node.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.2.dll

Declaration

[DXCategory("Property Changed")]
public event FocusedNodeChangedEventHandler FocusedNodeChanged

Event Data

The FocusedNodeChanged event's data class is FocusedNodeChangedEventArgs. The following properties provide information specific to this event:

Property Description
Node Gets the current Tree List node. Inherited from NodeEventArgs.
OldNode Gets the previously focused Tree List node.

Remarks

The FocusedNodeChanged event fires when focus moves from node to node for the following reasons:

  • Focus is moved to another node by an end-user or by changing the TreeList.FocusedNode property value.
  • Focus is moved to the added node when using the TreeList.AppendNode method.
  • Focus is moved to the focused node’s parent as a result of the collapse of the parent node.
  • The focused node is removed from the Tree List control.

You can respond to all the mentioned focused node changes by handling the FocusedNodeChanged event. Write a handler for this event if your application’s appearance or behavior depends on the currently focused node. For instance, you may want to display the information from the focused node, and therefore need to update this information when the focused node changes.

The Tree List control enables you to specify whether a particular node can obtain focus. Handle the TreeList.BeforeFocusNode event for this purpose.

If you need to forcibly move focus to a specific node while handling the FocusedNodeChanged event, you can assign the target node to the TreeList.FocusedNode property. Note that this code must be executed asynchronously using the BeginInvoke method:

private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) {
    //...
    this.BeginInvoke(new MethodInvoker(delegate {
        treeList1.FocusedNode = myTargetNode;
    }));
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the FocusedNodeChanged event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also