windowsforms-devexpress-dot-xtratreelist-dot-treelist-ec3320b0.md
Allows you to replace the applied filter with another filter.
Namespace : DevExpress.XtraTreeList
Assembly : DevExpress.XtraTreeList.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList
[DXCategory("Data")]
public event EventHandler<SubstituteFilterEventArgs> SubstituteFilter
<DXCategory("Data")>
Public Event SubstituteFilter As EventHandler(Of SubstituteFilterEventArgs)
The SubstituteFilter event's data class is SubstituteFilterEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Filter | Gets or sets the filter applied to a data control. |
The SubstituteFilter event fires when an end-user applies a new filter criterion to the control, allowing you to replace the applied filter with another one. The currently applied filter is specified by the Filter event argument. To replace this filter, assign a new filter criterion to this parameter.
private void treeList1_SubstituteFilter(object sender, DevExpress.Data.SubstituteFilterEventArgs e){
if (e.Filter.ToString() == "[DEPARTMENT] = 'Corporate Headquarters'"){
e.Filter = DevExpress.Data.Filtering.CriteriaOperator.Parse("[DEPARTMENT] = 'Corporate Headquarters' And [LOCATION] = 'Monterey'");
}
}
Private Sub treeList1_SubstituteFilter(sender As Object, e As DevExpress.Data.SubstituteFilterEventArgs)
If e.Filter.ToString() = "[DEPARTMENT] = 'Corporate Headquarters'" Then
e.Filter = DevExpress.Data.Filtering.CriteriaOperator.Parse("[DEPARTMENT] = 'Corporate Headquarters' And [LOCATION] = 'Monterey'")
End If
End Sub
Note
Do not modify the existing filter object assigned to the Filter event argument.
See Also