Skip to main content
A newer version of this page is available. .

PivotGridControl.FieldFilterChanging Event

Allows you to customize the filter that is being applied or cancel filtering.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v18.2.dll

Declaration

public event PivotFieldFilterChangingEventHandler FieldFilterChanging

Event Data

The FieldFilterChanging event's data class is PivotFieldFilterChangingEventArgs. The following properties provide information specific to this event:

Property Description
Cancel Gets or sets whether to cancel changing the filter condition.
Field Gets the field being processed. Inherited from PivotFieldEventArgs.
FilterType Gets the current filter type.
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.
Values Gets the collection of filter values, about to be assigned to the filter.

The event data class exposes the following methods:

Method Description
InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.

Remarks

The FieldFilterChanging event occurs before a field’s filter condition is changed. To obtain the collection of filter values which is about to be assigned to the filter, use the event parameter’s PivotFieldFilterChangingEventArgs.Values property. To cancel changing the current filter values collection, set the PivotFieldFilterChangingEventArgs.Cancel property to true. You can also obtain the field for which the filter condition is being changed, and the current filter type using the event parameter’s PivotFieldEventArgs.Field and PivotFieldFilterChangingEventArgs.FilterType properties, respectively.

After the filter condition has been changed, the PivotGridControl.FieldFilterChanged event is fired.

Note

To remove default filter items and add custom items instead, use the PivotGridControl.CustomFilterPopupItems event.

Example

The following example shows how to prevent end-users from changing the filter condition.In this example, the FieldFilterChanging event is handled to prevent an end-user from hiding the 'Beverages' field value. If an end-user tries to hide the 'Beverages' field value, the event handler sets the event parameter's Cancel property to true to cancel changing the filter condition.

<Window xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="DXPivotGrid_CancelFilterChanging.MainWindow" Height="500" Width="650" Title="Main Window">
    <Grid>
        <dxpg:PivotGridControl FieldFilterChanging="pivotGridControl1_FieldFilterChanging" Name="pivotGridControl1">
            <dxpg:PivotGridControl.Fields>
                <dxpg:PivotGridField Name="fieldProductSales" FieldName="ProductSales" Area="DataArea" Caption="Product Sales" />
                <dxpg:PivotGridField Name="fieldCategoryName" FieldName="CategoryName" Area="RowArea" AreaIndex="0" Caption="Category Name" />
                <dxpg:PivotGridField Name="fieldProductName" FieldName="ProductName" Area="RowArea" AreaIndex="1" Caption="Product Name" />
                <dxpg:PivotGridField Name="fieldShippedDate" FieldName="ShippedDate" Area="ColumnArea" GroupInterval="DateYear" Caption="Year" />
            </dxpg:PivotGridControl.Fields>
        </dxpg:PivotGridControl>
    </Grid>
</Window>

The following code snippets (auto-collected from DevExpress Examples) contain references to the FieldFilterChanging event.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also