バージョン

FilterComparisionOperator 列挙体

比較オペレータを示す列挙体。
シンタックス
'宣言
 
Public Enum FilterComparisionOperator 
   Inherits System.Enum
public enum FilterComparisionOperator : System.Enum 
メンバ
メンバ解説
Containsセルの値がオペランドを含むかどうかをテストします。
Customカスタム フィルターの作成に使用します。これは、FilterCondition からクラスを派生し、派生クラス内の MeetsCriteria メソッドをオーバーライドしてフィルター評価用のカスタム ロジックを実装するときに使用します。MeetsCriteria のデフォルトの実装では、Custom のフィルター比較演算子に対して常に True が返されます。したがって、FilterCondition から派生し、MeetsCriteria をカスタム フィルター用にオーバーライドする必要があります。
DoesNotContainContains の逆。
DoesNotEndWithEndsWith の逆。
DoesNotMatchMatchの逆。
DoesNotStartWithStartsWith の逆。
EndsWithセルの値がオペランドで終わるかどうかをテストします。
Equals2つの値が等しいかどうかをテストします。
GreaterThan列の値が特定の値より大きいかどうかをテストします。
GreaterThanOrEqualTo列の値が特定の値以上かどうかをテストします。
In値が指定した値かどうかを確認します。
LessThan列の値が特定の値より小さいかどうかをテストします。
LessThanOrEqualTo列の値が特定の値以下かどうかをテストします。
Like比較値 (ワイルドカードを含む文字列) に対して列の値のワイルドカード比較を実行します。
Match列の値と値を文字列比較。
NotEquals2 つの値が等しいかどうかをテストします。
NotIn値が指定した値ではないかどうかを確認します。
NotLikeLike の逆。
StartsWithセルの値がオペランドで始まるかどうかをテストします。
使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

    ' Derive a class from FilterCondition to create a custom filter criteria.
    ' Mark the class Serializable. This is only necessary if you intend to serialize 
    ' the filter condition object (Load and Save layouts with this filter applied).
    <Serializable()> _
    Private Class OddEvenFilterCondition
        Inherits FilterCondition

        ' This is only necessary if you intend to serialize the filter condition object.
        ' (Load and Save layouts with this filter applied).
        Protected Sub New( _
        ByVal info As System.Runtime.Serialization.SerializationInfo, _
        ByVal context As System.Runtime.Serialization.StreamingContext)
            MyBase.New(info, context)
        End Sub

        Sub New(ByVal column As UltraGridColumn, ByVal odd As Boolean)
            MyBase.New(column, FilterComparisionOperator.Custom, Nothing)

            ' Store any necessary information to the CompareValue property because the
            ' base class serializes the CompareValue. This is only necessary if you 
            ' intend to serialize filter condition object (Load and Save layouts with 
            ' this filter applied) and don't want to write your own code for serializing
            ' the information.
            Me.CompareValue = odd
        End Sub

        ' Override MeetsCriteria method and write your own code for filtering the row.
        Public Overrides Function MeetsCriteria(ByVal row As UltraGridRow) As Boolean

            ' Following code filters out the rows with odd or even values depending on
            ' the whether compare value is set to true or false.
            ' Following code filters out the rows with odd or even values depending on
            ' the whether compare value is set to true or false.
            Dim cellVal As Object = row.GetCellValue(Me.Column)
            Try
                Dim val As Integer = Convert.ToInt32(cellVal)

                Dim odd As Boolean = DirectCast(Me.CompareValue, Boolean)

                If odd Then
                    Return 1 = val Mod 2
                Else
                    Return 0 = val Mod 2
                End If
            Catch e As Exception
                ' Cell value was either DBNull or something that could not be converted
                ' to int. Return true to pass the row so that it's visible. (You could
                ' return false here if you want such rows to get hidden).
            End Try

        End Function
    End Class

    Private Sub UltraGrid1_BeforeRowFilterDropDown(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowFilterDropDownEventArgs) Handles UltraGrid1.BeforeRowFilterDropDown
        If e.Column.Key = "Col1" Then
            ' Clear all items from the filter drop down except (All) which allows the user
            ' to clear the filters on the column.
            Dim i As Integer
            For i = e.ValueList.ValueListItems.Count - 1 To 0 Step -1
                ' Remove Custom option from the filter drop down.
                If Not e.ValueList.ValueListItems(i).DisplayText.Equals("(All)") Then
                    e.ValueList.ValueListItems.RemoveAt(i)
                End If
            Next

            ' Add two items one that filters in rows that are odd and one that filters in rows
            ' that are even.
            e.ValueList.ValueListItems.Add(New OddEvenFilterCondition(e.Column, True), "Odd")
            e.ValueList.ValueListItems.Add(New OddEvenFilterCondition(e.Column, False), "Even")
        End If
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		// Derive a class from FilterCondition to create a custom filter criteria.
		// Mark the class Serializable. This is only necessary if you intend to serialize 
		// the filter condition object (Load and Save layouts with this filter applied).
		[ Serializable() ]
		private class OddEvenFilterCondition : FilterCondition
		{
			// This is only necessary if you intend to serialize the filter condition object.
			// (Load and Save layouts with this filter applied).
			/// <summary>
			/// Constructor for serialization.
			/// </summary>
			/// <param name="info"></param>
			/// <param name="context"></param>
			protected OddEvenFilterCondition( 
				System.Runtime.Serialization.SerializationInfo info, 
				System.Runtime.Serialization.StreamingContext context )
				: base( info, context )
			{
			}

			/// <summary>
			/// Constructor.
			/// </summary>
			/// <param name="column"></param>
			/// <param name="odd"></param>
			internal OddEvenFilterCondition( UltraGridColumn column, bool odd ) : 
				base( column, FilterComparisionOperator.Custom, null )
			{
				// Store any necessary information to the CompareValue property because the
				// base class serializes the CompareValue. This is only necessary if you 
				// intend to serialize filter condition object (Load and Save layouts with 
				// this filter applied) and don't want to write your own code for serializing
				// the information.
				this.CompareValue = odd;
			}

			// Override MeetsCriteria method and write your own code for filtering the row.
			public override bool MeetsCriteria( UltraGridRow row )
			{
				// Following code filters out the rows with odd or even values depending on
				// the whether compare value is set to true or false.
				object cellVal = row.GetCellValue( this.Column );
				try
				{
					int val = Convert.ToInt32( cellVal );
					
					bool odd = (bool)this.CompareValue;
					if ( odd )
						return 1 == val % 2;
					else
						return 0 == val % 2;
				}
				catch ( Exception )
				{
					// Cell value was either DBNull or something that could not be converted
					// to int. Return true to pass the row so that it's visible. (You could
					// return false here if you want such rows to get hidden).
					return true;
				}
			}
		}

		private void ultraGrid1_BeforeRowFilterDropDown(object sender, Infragistics.Win.UltraWinGrid.BeforeRowFilterDropDownEventArgs e)
		{
			if ( e.Column.Key == "Col1" )
			{
				// Clear all items from the filter drop down except (All) which allows the user
				// to clear the filters on the column.
				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( "(All)" ) )
						e.ValueList.ValueListItems.RemoveAt( i );
				}

				// Add two items one that filters in rows that are odd and one that filters in rows
				// that are even.
				e.ValueList.ValueListItems.Add( new OddEvenFilterCondition( e.Column, true ), "Odd" );
				e.ValueList.ValueListItems.Add( new OddEvenFilterCondition( e.Column, false ), "Even" );
			}
		}
参照