Version

RecordFilterChanging Event

Raised when the user changes record filter criteria.
Syntax
'Declaration
 
Public Event RecordFilterChanging As EventHandler(Of RecordFilterChangingEventArgs)
public event EventHandler<RecordFilterChangingEventArgs> RecordFilterChanging
Event Data

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

PropertyDescription
Cancel (Inherited from Infragistics.Windows.Controls.Events.CancelableRoutedEventArgs) 
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.
NewRecordFilter Returns the modified record filters.
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.
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

RecordFilterChanging is raised whenever the user enters new or modifies existing record filtering criteria. This event is raised right before the modified criteria is applied.

Note that you can cancel this event in which case the user modifications to the filter criteria will be discarded. Filter criteria will revert back to original filter criteria if any.

Example
The following code demonstrates usage of RecordFilterChanging and RecordFilterChanged events.

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_RecordFilterChanging(ByVal sender As Object, ByVal e As RecordFilterChangingEventArgs)
        ' NewRecordFilter property returns the new filter criteria for the field.
        Dim newFilter As RecordFilter = e.NewRecordFilter
        Dim field As Field = newFilter.Field

        ' Print out the new filter conditions.
        If newFilter.Conditions.Count > 0 Then
            Debug.WriteLine("Record filter of " + field.Name + " field is being changed to " + newFilter.Conditions.ToolTip.ToString())
        Else
            Debug.WriteLine("Record filter of " & field.Name & " field is being cleared.")
        End If

        ' You can cancel the the change by seeting Cancel property.
        'e.Cancel = true;
    End Sub

    Private Sub Dp_RecordFilterChanged(ByVal sender As Object, ByVal e As RecordFilterChangedEventArgs)
        ' RecordFilter property returns the new filter criteria for the field.
        Dim newFilter As RecordFilter = e.RecordFilter
        Dim field As Field = newFilter.Field

        ' Print out the new filter conditions.
        If newFilter.Conditions.Count > 0 Then
            Debug.WriteLine("Record filter of " + field.Name + " field has been changed to " + newFilter.Conditions.ToolTip.ToString())
        Else
            Debug.WriteLine("Record filter of " & field.Name & " field has been cleared.")
        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_RecordFilterChanging( object sender, RecordFilterChangingEventArgs e )
		{
			// NewRecordFilter property returns the new filter criteria for the field.
			RecordFilter newFilter = e.NewRecordFilter;
			Field field = newFilter.Field;

			// Print out the new filter conditions.
			if ( newFilter.Conditions.Count > 0 )
				Debug.WriteLine( "Record filter of " + field.Name + " field is being changed to " + newFilter.Conditions.ToolTip.ToString( ) );
			else
				Debug.WriteLine( "Record filter of " + field.Name + " field is being cleared." );

			// You can cancel the the change by seeting Cancel property.
			//e.Cancel = true;
		}

		private void dp_RecordFilterChanged( object sender, RecordFilterChangedEventArgs e )
		{
			// RecordFilter property returns the new filter criteria for the field.
			RecordFilter newFilter = e.RecordFilter;
			Field field = newFilter.Field;

			// Print out the new filter conditions.
			if ( newFilter.Conditions.Count > 0 )
				Debug.WriteLine( "Record filter of " + field.Name + " field has been changed to " + newFilter.Conditions.ToolTip.ToString( ) );
			else
				Debug.WriteLine( "Record filter of " + field.Name + " field has been cleared." );
		}
The following XAML code hooks into RecordFilterChanging and RecordFilterChanged events and enables the record filtering functionality.
        <igDP:XamDataGrid x:Name="_dp" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                            
RecordFilterChanging="dp_RecordFilterChanging"
                                            
RecordFilterChanged="dp_RecordFilterChanged"
                                        
>

            
<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