バージョン

ColumnFilter クラス

ColumnFilter クラス。
シンタックス
'宣言
 
Public Class ColumnFilter 
   Inherits Infragistics.Shared.KeyedSubObjectBase
   Implements Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx 
public class ColumnFilter : Infragistics.Shared.KeyedSubObjectBase, Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx  
解説

FilterCondition オブジェクトは 1 つの条件を定義します。FilterConditionsCollection には複数の FilterCondition インスタンスを追加できます。ColumnFilter インスタンスには FilterConditionsCollection インスタンスが含まれます。ColumnFilter は、ColumnFilter の FilterConditionCollection に含まれる複数の条件の結合方法を指定する LogicalOperator プロパティを持ちます。ColumnFiltersCollection には複数の ColumnFilter インスタンスを格納できます。UltraGridBand オブジェクトと RowsCollection オブジェクトの両方で ColumnFilters プロパティが公開されています。このプロパティは ColumnFilter オブジェクトのコレクションを返します。UltraGrid は行をフィルタリングする際、Override の UltraGridOverride.RowFilterMode プロパティの設定値に基づいて RowsCollection の RowsCollection.ColumnFilters または UltraGridBand の UltraGridBand.ColumnFilters のどちらかを使用します。詳細は UltraGridOverride.RowFilterMode を参照してください。

使用例
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" );
			}
		}
参照