Version

CustomFilterSelectionControlOpening Event

Raised before the UI for entering custom filter criteria for a field is displayed. You can cancel this event and display your own UI.
Syntax
'Declaration
 
Public Event CustomFilterSelectionControlOpening As EventHandler(Of CustomFilterSelectionControlOpeningEventArgs)
public event EventHandler<CustomFilterSelectionControlOpeningEventArgs> CustomFilterSelectionControlOpening
Event Data

The event handler receives an argument of type CustomFilterSelectionControlOpeningEventArgs containing data related to this event. The following CustomFilterSelectionControlOpeningEventArgs properties provide information specific to this event.

PropertyDescription
Cancel (Inherited from Infragistics.Windows.Controls.Events.CancelableRoutedEventArgs) 
Control Returns the control being displayed in the UI for selecting custom filter criteria for field(s) (read-only).
FieldLayout Returns the FieldLayout associated with the Infragistics.Windows.DataPresenter.Field(s) for which the Infragistics.Windows.DataPresenter.CustomFilterSelectionControl will be creating/editing filters. (read-only).
FilterType Returns the Infragistics.Windows.DataPresenter.CustomFilterSelectionControlFilterType that represents the type of filters that the Infragistics.Windows.DataPresenter.CustomFilterSelectionControl will be creating/editing. (read-only).
Handled (Inherited from System.Windows.RoutedEventArgs)Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.
OriginalSource (Inherited from System.Windows.RoutedEventArgs)Gets the original reporting source as determined by pure hit testing, before any possible System.Windows.RoutedEventArgs.Source adjustment by a parent class.
RecordFilter Returns the RecordFilter instance that will be modified by the filter selection control when the FilterType is Infragistics.Windows.DataPresenter.CustomFilterSelectionControlFilterType.SingleField. Otherwise returns null (read only).
RecordManager Returns the RecordManager that should be used to determine the unique values to display for each Infragistics.Windows.DataPresenter.Field when creating/editing filters. (read-only).
RoutedEvent (Inherited from System.Windows.RoutedEventArgs)Gets or sets the System.Windows.RoutedEventArgs.RoutedEvent associated with this System.Windows.RoutedEventArgs instance.
Source (Inherited from System.Windows.RoutedEventArgs)Gets or sets a reference to the object that raised the event.
Remarks

CustomFilterSelectionControlOpening is raised before the user interface for entering custom filter criteria is displayed. This happens when the user selects '(Custom)' entry from the filter drop-down. To enable the filtering functionality, set the FieldSettings.AllowRecordFiltering and FieldLayoutSettings.FilterUIType properties.

Note that you can cancel this event in which case the UI will not be displayed. This lets you display your own UI for letting the user enter custom filter criteria. Also note that you can use the RecordFilterDropDownPopulating event to remove the '(Custom)' entry from the filter drop-down list or add any other custom filter entries.

Example
The following code demonstrates usage of CustomFilterSelectionControlOpening event.

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.Windows
Imports Infragistics.Windows.Controls
Imports Infragistics.Windows.Editors
Imports Infragistics.Windows.DataPresenter
Imports Infragistics.Windows.DataPresenter.Events

    Private Sub Dp_CustomFilterSelectionControlOpening(ByVal sender As Object, ByVal e As CustomFilterSelectionControlOpeningEventArgs)
        ' RecordFilter returns the filter that is to be manipulated by the custom
        ' filter dialog.
        Dim filter As RecordFilter = e.RecordFilter

        ' You can get the field for which the custom filter dialog is opening by
        ' using the RecordFilter's Field property.
        Dim field As Field = filter.Field

        ' Control property returns the CustomFilterSelectionControl that will
        ' be displayed.
        Dim customFilterControl As CustomFilterSelectionControl = e.Control

        ' Print a message.
        Debug.WriteLine("Custom filter dialog is being displayed for field " & field.Name)

        ' You can set Cancel to true to prevent the data presenter from displaying
        ' the custom filter dialog.
        e.Cancel = True

        ' Setting Cancel to true lets you display display your own custom filter 
        ' dialog. All you need to do is update the e.RecordFilter with the conditions
        ' that the user selects from your custom dialog.
    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_CustomFilterSelectionControlOpening( object sender, CustomFilterSelectionControlOpeningEventArgs e )
		{
			// RecordFilter returns the filter that is to be manipulated by the custom
			// filter dialog.
			RecordFilter filter = e.RecordFilter;

			// You can get the field for which the custom filter dialog is opening by
			// using the RecordFilter's Field property.
			Field field = filter.Field;

			// Control property returns the CustomFilterSelectionControl that will
			// be displayed.
			CustomFilterSelectionControl customFilterControl = e.Control;

			// Print a message.
			Debug.WriteLine( "Custom filter dialog is being displayed for field " + field.Name );

			// You can set Cancel to true to prevent the data presenter from displaying
			// the custom filter dialog.
			e.Cancel = true;

			// Setting Cancel to true lets you display display your own custom filter 
			// dialog. All you need to do is update the e.RecordFilter with the conditions
			// that the user selects from your custom dialog.
		}
        <igDP:XamDataGrid x:Name="_dp" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                            
CustomFilterSelectionControlOpening="dp_CustomFilterSelectionControlOpening"
                                        
>

            
<igDP:XamDataGrid.FieldSettings>
                
<!--Set AllowRecordFiltering to enable filter-record.-->
                
<igDP:FieldSettings AllowRecordFiltering="true" />
            
</igDP:XamDataGrid.FieldSettings>
            
        
</igDP:XamDataGrid>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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