Version

Filter Operands

Please note that this control has been retired and is now obsolete to the XamDataGrid control, and as such, we recommend migrating to that control. It will not be receiving any new features, bug fixes, or support going forward. 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;
   }
}