このプロパティを False に設定して、データ プレゼンターがフィルター ドロップダウン リストにフィールド値を含めないことができます。
Imports Infragistics.Windows Imports Infragistics.Windows.Controls Imports Infragistics.Windows.Editors Imports Infragistics.Windows.DataPresenter Imports Infragistics.Windows.DataPresenter.Events Private Sub Dp_RecordFilterDropDownPopulating(ByVal sender As Object, ByVal e As RecordFilterDropDownPopulatingEventArgs) If e.Field.EditAsTypeResolved Is GetType(String) Then ' At this point, e.DropDownItems will be pre-populated with special operands, like ' (Custom), (Blanks), (NonBlanks) etc... You can remove them if you don't want to ' display those options. ' ' Remove all but (All) and (Custom) items from the drop-down. ' Dim i As Integer For i = e.DropDownItems.Count - 1 To 0 Step -1 ' Remove all but (All) and (Custom) items from the list. ' If Not e.DropDownItems(i).DisplayText.StartsWith("(All)") _ AndAlso Not e.DropDownItems(i).DisplayText.StartsWith("(Custom)") Then e.DropDownItems.RemoveAt(i) End If Next ' After this event is raised, data presenter will populate the drop-down with ' field values. If you don't want to display field values in the filter drop-down ' then set IncludeUniqueValues to false, which will prevent the data presenter ' from adding field values to the drop-down. ' e.IncludeUniqueValues = False ' Add custom items. Items can be ICondition derived class (here we are using built-in ' ComparisonCondition), or a SpecialFilterBase derived class, or a ICommand (which ' lets you to take an action, like show a dialog). You can even implement your own ' ICondition to provide completely custom logic. ' Dim item As FilterDropDownItem item = New FilterDropDownItem(New ComparisonCondition(ComparisonOperator.Match, "^[A-F]"), "A-F") e.DropDownItems.Add(item) item = New FilterDropDownItem(New ComparisonCondition(ComparisonOperator.Match, "^[G-K]"), "G-K") e.DropDownItems.Add(item) item = New FilterDropDownItem(New ComparisonCondition(ComparisonOperator.Match, "^[L-P]"), "L-P") e.DropDownItems.Add(item) item = New FilterDropDownItem(New ComparisonCondition(ComparisonOperator.Match, "^[Q-Z]"), "Q-Z") e.DropDownItems.Add(item) End If End Sub
using Infragistics.Windows; using Infragistics.Windows.Controls; using Infragistics.Windows.Editors; using Infragistics.Windows.DataPresenter; using Infragistics.Windows.DataPresenter.Events; private void dp_RecordFilterDropDownPopulating( object sender, RecordFilterDropDownPopulatingEventArgs e ) { if ( e.Field.EditAsTypeResolved == typeof( string ) ) { // At this point, e.DropDownItems will be pre-populated with special operands, like // (Custom), (Blanks), (NonBlanks) etc... You can remove them if you don't want to // display those options. // // Remove all but (All) and (Custom) items from the drop-down. // for ( int i = e.DropDownItems.Count - 1; i >= 0; i-- ) { // Remove all but (All) and (Custom) items from the list. // if ( ! e.DropDownItems[i].DisplayText.StartsWith( "(All)" ) && ! e.DropDownItems[i].DisplayText.StartsWith( "(Custom)" ) ) { e.DropDownItems.RemoveAt( i ); } } // After this event is raised, data presenter will populate the drop-down with // field values. If you don't want to display field values in the filter drop-down // then set IncludeUniqueValues to false, which will prevent the data presenter // from adding field values to the drop-down. // e.IncludeUniqueValues = false; // Add custom items. Items can be ICondition derived class (here we are using built-in // ComparisonCondition), or a SpecialFilterBase derived class, or a ICommand (which // lets you to take an action, like show a dialog). You can even implement your own // ICondition to provide completely custom logic. // FilterDropDownItem item; item = new FilterDropDownItem( new ComparisonCondition( ComparisonOperator.Match, "^[A-F]" ), "A-F" ); e.DropDownItems.Add( item ); item = new FilterDropDownItem( new ComparisonCondition( ComparisonOperator.Match, "^[G-K]" ), "G-K" ); e.DropDownItems.Add( item ); item = new FilterDropDownItem( new ComparisonCondition( ComparisonOperator.Match, "^[L-P]" ), "L-P" ); e.DropDownItems.Add( item ); item = new FilterDropDownItem( new ComparisonCondition( ComparisonOperator.Match, "^[Q-Z]" ), "Q-Z" ); e.DropDownItems.Add( item ); } }