バージョン

FieldFilters プロパティ

フィールド グループのコレクションを指定します。各フィールド レイアウトは、このプロパティの設定に基づいてフィールドをサブグループに分割します。
シンタックス
'宣言
 
Public ReadOnly Property FieldFilters As ObservableCollection(Of FieldChooserFilter)
public ObservableCollection<FieldChooserFilter> FieldFilters {get;}
解説

FieldFilters プロパティでフィールドのグループを指定できます。各フィールド レイアウトのフィールドをサブグループに分割できます。例えば、Customers/Orders の階層データ ソースでは、Orders フィールド レイアウトのフィールドを「Date フィールド」、「Address フィールド」、「Phone/Fax フィールド」などのグループに分割できます。フィールド レイアウト セレクターは、このサブグループを使用可能なフィールド レイアウトの下に表示します。例えば、エンド ユーザーがフィールド レイアウト セレクターで「Orders」の下にある「Date フィールド」エントリを選択すると、Orders フィールド レイアウトの日付フィールドのみ表示されます。

使用例
Imports Infragistics.Windows
Imports Infragistics.Windows.Controls
Imports Infragistics.Windows.Editors
Imports Infragistics.Windows.DataPresenter
Imports Infragistics.Windows.DataPresenter.Events

    Private Sub Dp_FieldChooserOpening(ByVal sender As Object, ByVal e As FieldChooserOpeningEventArgs)
        Dim fieldChooser As FieldChooser = e.FieldChooser

        ' Only add field filters if we haven't already added previously. FieldChooserOpening
        ' gets raised every time the field chooser is displayed by the data presenter.
        ' 
        If fieldChooser.FieldFilters.Count = 0 Then
            ' Create a FieldChooserFilter that creates a group of address fields.
            Dim addressFieldsFilter As FieldChooserFilter = New FieldChooserFilter()
            addressFieldsFilter.Description = "Address Fields"
            addressFieldsFilter.ToolTip = "Displays address related fields"
            addressFieldsFilter.Filter = New Predicate(Of Field)(AddressOf IsAddressField)

            ' Create a FieldChooserFilter that creates a group of date fields.
            Dim dateFieldsFilter As FieldChooserFilter = New FieldChooserFilter()
            dateFieldsFilter.Description = "Date Fields"
            dateFieldsFilter.ToolTip = "Displays date fields"
            dateFieldsFilter.Filter = New Predicate(Of Field)(AddressOf IsDateField)

            ' Add the above filters to the collection returned by the field chooser's 
            ' FieldFilters property.
            fieldChooser.FieldFilters.Add(addressFieldsFilter)
            fieldChooser.FieldFilters.Add(dateFieldsFilter)
        End If
    End Sub

    Private Function IsAddressField(ByVal field As Field) As Boolean
        ' Create a list of fields that belong to this group.
        Dim addressFields As String() = _
        { _
           "Full_Name", _
           "Address_Line1", _
           "Address_Line2", _
           "City", _
           "State", _
           "Zip", _
           "Country" _
        }

        Return Array.IndexOf(addressFields, field.Name) >= 0
    End Function

    Public Function IsDateField(ByVal field As Field) As Boolean
        Return field.DataType Is GetType(DateTime) OrElse field.DataType Is GetType(Nullable(Of DateTime))
    End Function
using Infragistics.Windows;
using Infragistics.Windows.Controls;
using Infragistics.Windows.Editors;
using Infragistics.Windows.DataPresenter;
using Infragistics.Windows.DataPresenter.Events;

		private void dp_FieldChooserOpening( object sender, FieldChooserOpeningEventArgs e )
		{
			FieldChooser fieldChooser = e.FieldChooser;

			// Only add field filters if we haven't already added previously. FieldChooserOpening
			// gets raised every time the field chooser is displayed by the data presenter.
			// 
			if ( fieldChooser.FieldFilters.Count == 0 )
			{
				// Create a FieldChooserFilter that creates a group of address fields.
				FieldChooserFilter addressFieldsFilter = new FieldChooserFilter( );
				addressFieldsFilter.Description = "Address Fields";
				addressFieldsFilter.ToolTip = "Displays address related fields";
				addressFieldsFilter.Filter = new Predicate<Field>(
					delegate( Field field )
					{
						// Create a list of fields that belong to this group.
						string[] addressFields = new string[]
						{
							"Full_Name",
							"Address_Line1",
							"Address_Line2",
							"City",
							"State",
							"Zip",
							"Country"
						};

						return Array.IndexOf( addressFields, field.Name ) >= 0;
					}
				);

				// Create a FieldChooserFilter that creates a group of date fields.
				FieldChooserFilter dateFieldsFilter = new FieldChooserFilter( );
				dateFieldsFilter.Description = "Date Fields";
				dateFieldsFilter.ToolTip = "Displays date fields";
				dateFieldsFilter.Filter = new Predicate<Field>(
					delegate( Field field )
					{
						return field.DataType == typeof( DateTime ) || field.DataType == typeof( DateTime? );
					}
				);

				// Add the above filters to the collection returned by the field chooser's 
				// FieldFilters property.
				fieldChooser.FieldFilters.Add( addressFieldsFilter );
				fieldChooser.FieldFilters.Add( dateFieldsFilter );
			}
		}
参照