New to Telerik UI for WinFormsStart a free 30-day trial

Events

Updated over 6 months ago

RadTreeView provides a large set of events which allows you to respond to node interactions.

  • NodeAdded/NodeAdding: The events occur before and after node is added.

  • NodeRemoved/NodeRemoving: The events occur before and after node is removed.

  • NodeExpandedChanged/NodeExpandedChanging: The events occur before and after node is expanded or collapsed.

  • NodeMouseClick/NodeMouseDoubleClick: The events occur when a node is clicked or double clicked.

Since R3 2020 the NodeMouseClick/NodeMouseDoubleClick events offer one additional parameter which allows access to the original MouseEventArgs. It is necessary to cast the event arguments to RadTreeViewMouseEventArgs.

  • SelectedNodeChanging: The event occurs before a tree node is selected.

  • SelectedNodeChanged: The event occurs after the tree node is selected.

Note that SelectedNodeChanged event fires twice. For more information, you can see the Selecting Nodes article.

  • SelectedNodesChanged - the event occurs when SelectedNodes collection has been changed.
C#
private void RadTreeView1_NodeMouseClick(object sender, RadTreeViewEventArgs e)
{
    RadTreeViewMouseEventArgs args = e as RadTreeViewMouseEventArgs;
    if (args.OriginalEventArgs.Button == MouseButtons.Right)
    {
        //TO DO
    }
}

The above events are using RadTreeViewEventArgs and RadTreeViewCancelEventArgs objects to provide you with useful information inside the events. The main difference is that you can cancel the interaction in the second case. These objects are exposing the following information:

ParameterDescription
ActionIndicates how the node was changed. Can have the following values: ByKeyboard; ByMouse; Unknown.
NodeThe node that has been changed.
TreeElementGives the main TreeView element the node belongs to.
TreeViewReturns the TreeView control that holds the current node.
CancelAllows you to cancel the change.(Only available in the RadTreeViewCancelEventArgs object)

See Also

In this article
See Also
Not finding the help you need?
Contact Support