Back to Devexpress

FilterControl.InitNode Event

windowsforms-devexpress-dot-xtraeditors-dot-filtercontrol-f067fd1d.md

latest3.6 KB
Original Source

FilterControl.InitNode Event

Allows you to customize a node’s settings when it is initialized.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event InitNodeEventHandler InitNode
vb
<DXCategory("Events")>
Public Event InitNode As InitNodeEventHandler

Event Data

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

PropertyDescription
IsNewNodeGets whether the node is newly created.
PropertyNameGets or sets the property (field) name.
PropertyTypeGets the type of the current property (column/field). Inherited from BaseNodeEventArgs.

The event data class exposes the following methods:

MethodDescription
SetOperation(FunctionOperatorType)Sets the operation type for the current node.
SetOperation(ClauseType)Sets the operation type for the current node.
SetOperation(String)Applies a registered custom function to the current node.

Remarks

The InitNode event fires in the following cases:

  • You add a new node in the Filter Control. In this case, the IsNewNode event parameter returns true.
  • You change the property (field) name for an existing node (via a dropdown list). In this case, the IsNewNode event parameter returns false.

To change the operation type for the current node, use the SetOperation method (available from the event arguments).

Example

The following example sets the default operation type to GreaterOrEqual for the UnitPrice field.

csharp
private void filterControl1_InitNode(object sender, DevExpress.XtraEditors.Filtering.InitNodeEventArgs e) {
    if (e.PropertyName == "UnitPrice")
        e.SetOperation(DevExpress.Data.Filtering.Helpers.ClauseType.GreaterOrEqual);
}
vb
Private Sub FilterControl1_InitNode(sender As Object, e As DevExpress.XtraEditors.Filtering.InitNodeEventArgs) Handles FilterControl1.InitNode
    If e.PropertyName = "UnitPrice" Then
        e.SetOperation(DevExpress.Data.Filtering.Helpers.ClauseType.GreaterOrEqual)
    End If
End Sub

See Also

FilterControl Class

FilterControl Members

DevExpress.XtraEditors Namespace