Version

BeforeRowFilterDropDownEventHandler Delegate

delegate for handling event that is fired before row-filter dropdown is dropped down.
Syntax
'Declaration
 
Public Delegate Sub BeforeRowFilterDropDownEventHandler( _
   ByVal sender As Object, _
   ByVal e As BeforeRowFilterDropDownEventArgs _
) 
public delegate void BeforeRowFilterDropDownEventHandler( 
   object sender,
   BeforeRowFilterDropDownEventArgs e
)

Parameters

sender
e
Example
Following code shows some of the information available in BeforeRowFilterDropDown event. It shows how to manipulate the items in the filter drop down and also add custom filter items.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
        e.Layout.Override.AllowRowFiltering = DefaultableBoolean.True
    End Sub

    Private Sub UltraGrid1_BeforeRowFilterDropDown(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowFilterDropDownEventArgs) Handles UltraGrid1.BeforeRowFilterDropDown
        ' You can modify the ValueList in the event args. Following for loop removes
        ' Custom and Blanks items from the value list.
        Dim i As Integer
        For i = e.ValueList.ValueListItems.Count - 1 To 0 Step -1
            ' Remove Custom option from the filter drop down.
            If e.ValueList.ValueListItems(i).DisplayText.Equals("(Custom)") Then
                e.ValueList.ValueListItems.RemoveAt(i)
            End If

            ' Remove Blanks option from the filter drop down.
            If e.ValueList.ValueListItems(i).DisplayText.Equals("(Blanks)") Then
                e.ValueList.ValueListItems.RemoveAt(i)
            End If
        Next

        If GetType(String) Is e.Column.DataType Then
            Dim condition As FilterCondition
            ' You can add items with custom criteria as well by using FilterCondition object
            ' as the DataValue of the value list item.				
            condition = New FilterCondition(e.Column, FilterComparisionOperator.Match, "^[A-Ha-h]")
            e.ValueList.ValueListItems.Insert(0, condition, "A to H")

            condition = New FilterCondition(e.Column, FilterComparisionOperator.Match, "^[I-Pi-p]")
            e.ValueList.ValueListItems.Insert(1, condition, "I to P")

            condition = New FilterCondition(e.Column, FilterComparisionOperator.Match, "^[Q-Zq-z]")
            e.ValueList.ValueListItems.Insert(2, condition, "Q to Z")
        End If

        If GetType(Integer) Is e.Column.DataType Then
            Dim conditions As ColumnFilter
            ' You can also add items with custom criteria by using ColumnFilter object
            ' as the DataValue of the value list item.
            conditions = New ColumnFilter(e.Column, FilterLogicalOperator.And)
            conditions.FilterConditions.Add(FilterComparisionOperator.LessThan, 50)
            e.ValueList.ValueListItems.Insert(0, conditions, "49 and below")

            conditions = New ColumnFilter(e.Column, FilterLogicalOperator.And)
            conditions.FilterConditions.Add(FilterComparisionOperator.GreaterThanOrEqualTo, 50)
            conditions.FilterConditions.Add(FilterComparisionOperator.LessThan, 100)
            e.ValueList.ValueListItems.Insert(0, conditions, "50 to 99")

            conditions = New ColumnFilter(e.Column, FilterLogicalOperator.And)
            conditions.FilterConditions.Add(FilterComparisionOperator.GreaterThanOrEqualTo, 100)
            e.ValueList.ValueListItems.Insert(0, conditions, "100 and above")
        End If
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			e.Layout.Override.AllowRowFiltering = DefaultableBoolean.True;
		}

		private void ultraGrid1_BeforeRowFilterDropDown(object sender, Infragistics.Win.UltraWinGrid.BeforeRowFilterDropDownEventArgs e)
		{
			// You can modify the ValueList in the event args. Following for loop removes
			// Custom and Blanks items from the value list.
			for ( int i = e.ValueList.ValueListItems.Count - 1; i >= 0; i-- )
			{
				// Remove Custom option from the filter drop down.
				if ( e.ValueList.ValueListItems[i].DisplayText.Equals( "(Custom)" ) )
					e.ValueList.ValueListItems.RemoveAt( i );

				// Remove Blanks option from the filter drop down.
				if ( e.ValueList.ValueListItems[i].DisplayText.Equals( "(Blanks)" ) )
					e.ValueList.ValueListItems.RemoveAt( i );
			}

			if ( typeof( string) == e.Column.DataType )
			{
				FilterCondition condition;
				// You can add items with custom criteria as well by using FilterCondition object
				// as the DataValue of the value list item.				
				condition = new FilterCondition( e.Column, FilterComparisionOperator.Match, "^[A-Ha-h]" );
				e.ValueList.ValueListItems.Insert( 0, condition, "A to H" );

				condition = new FilterCondition( e.Column, FilterComparisionOperator.Match, "^[I-Pi-p]" );
				e.ValueList.ValueListItems.Insert( 1, condition, "I to P" );

				condition = new FilterCondition( e.Column, FilterComparisionOperator.Match, "^[Q-Zq-z]" );
				e.ValueList.ValueListItems.Insert( 2, condition, "Q to Z" );
			}

			if ( typeof( int ) == e.Column.DataType )
			{
				ColumnFilter conditions;
				// You can also add items with custom criteria by using ColumnFilter object
				// as the DataValue of the value list item.
				conditions = new ColumnFilter( e.Column, FilterLogicalOperator.And );
				conditions.FilterConditions.Add( FilterComparisionOperator.LessThan, 50 );
				e.ValueList.ValueListItems.Insert( 0, conditions, "49 and below" );
				
				conditions = new ColumnFilter( e.Column, FilterLogicalOperator.And );
				conditions.FilterConditions.Add( FilterComparisionOperator.GreaterThanOrEqualTo, 50 );
				conditions.FilterConditions.Add( FilterComparisionOperator.LessThan, 100 );
				e.ValueList.ValueListItems.Insert( 0, conditions, "50 to 99" );

				conditions = new ColumnFilter( e.Column, FilterLogicalOperator.And );
				conditions.FilterConditions.Add( FilterComparisionOperator.GreaterThanOrEqualTo, 100 );
				e.ValueList.ValueListItems.Insert( 0, conditions, "100 and above" );
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also