Skip to main content

How to: Prevent End-Users From Changing Filter Conditions

  • 2 minutes to read

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.

View Example

<Window xmlns:dxpg="" xmlns="" xmlns:dxb="" xmlns:x="" x:Class="DXPivotGrid_CancelFilterChanging.MainWindow" Height="500" Width="650" Title="Main Window">
        <dxpg:PivotGridControl FieldFilterChanging="pivotGridControl1_FieldFilterChanging" Name="pivotGridControl1">
                <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" />