The event handler receives an argument of type BeforeFocusNodeEventArgs containing data related to this event.
The following
BeforeFocusNodeEventArgs properties provide information specific to this event.
Property |
Description |
CanFocus |
Gets or sets a value indicating whether focus is allowed to be moved. |
Node |
Gets the current Tree List node. |
OldNode |
Gets the previously focused Tree List node. |
The BeforeFocusNode event is raised each time a node is about to lose focus. The previously and currently focused nodes can be identified by the event parameter's NodeEventArgs.Node and FocusedNodeChangedEventArgs.OldNode properties, respectively. The BeforeFocusNodeEventArgs.CanFocus property specifies whether the node can be focused. To prevent node focus changing, set this property to false.
Once the focused node has been changed, the FocusedNodeChanged and AfterFocusNode events are raised.

Example
The following example prohibits focusing the first node within the control, by handling the BeforeFocusNode event.
C# |
private void treeList1_BeforeFocusNode(object sender,
DevExpress.XtraTreeList.BeforeFocusNodeEventArgs e) {
if (e.Node.Id == (sender as TreeList).Nodes[0].Id)
e.CanFocus = false;
}
|
VB |
Private Sub TreeList1_BeforeFocusNode(ByVal sender As Object,
ByVal e As DevExpress.XtraTreeList.BeforeFocusNodeEventArgs)
Handles TreeList1.BeforeFocusNode
If e.Node.Id = TryCast(sender, TreeList).Nodes(0).Id Then
e.CanFocus = False
End If
End Sub
|