Dim fcs As FilterColumnSettings = Me.MyDataGrid.Columns.DataColumns("ProductID").FilterColumnSettings fcs.RowFilterOperands.Remove(ComparisonOperator.Equals)
We recommend that you use the xamDataGrid control instead of the xamGrid control. The xamGrid is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamGrid during this time. For help or questions on migrating your codebase to the xamDataGrid, please contact support.
Remove Certain Filter Operands
The filtering feature of the xamGrid™ control offers various operands by default. However, there may be certain situations where you do not want your end users to filter on certain operands. You can remove certain filter operands from the filter row by removing the operands from the FilterColumnSettings object’s RowFilterOperands collection.
The following code demonstrates how to achieve this.
In Visual Basic:
Dim fcs As FilterColumnSettings = Me.MyDataGrid.Columns.DataColumns("ProductID").FilterColumnSettings fcs.RowFilterOperands.Remove(ComparisonOperator.Equals)
In C#:
FilterColumnSettings fcs = this.MyDataGrid.Columns.DataColumns["ProductID"].FilterColumnSettings; fcs.RowFilterOperands.Remove(ComparisonOperator.Equals);
Change the Default Filter Operands
The default filter that appears in the FilterRow of the xamGrid control is Equals. However, you can change this default filter to any other filter of your choice.
The following code demonstrates how to change the default filter to Contains.
In Visual Basic:
For Each f As FilterOperand In Me.MyDataGrid.Columns.DataColumns("ProductName").FilterColumnSettings.RowFilterOperands If (f.ComparisonOperatorValue = ComparisonOperator.Contains) Then Me.MyDataGrid.Columns.DataColumns("ProductName").FilterColumnSettings.FilteringOperand = f Exit For End If Next
In C#:
foreach (FilterOperand f in this.MyDataGrid.Columns.DataColumns["ProductName"].FilterColumnSettings.RowFilterOperands) { if (f.ComparisonOperatorValue == ComparisonOperator.Contains) { this.MyDataGrid.Columns.DataColumns["ProductName"].FilterColumnSettings.FilteringOperand = f; break; } }