Back to Devexpress

FieldFilterValues.FilterType Property

wpf-devexpress-dot-xpf-dot-pivotgrid-dot-fieldfiltervalues.md

latest6.3 KB
Original Source

FieldFilterValues.FilterType Property

Gets or sets the field’s filter type.

Namespace : DevExpress.Xpf.PivotGrid

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

NuGet Package : DevExpress.Wpf.PivotGrid

Declaration

csharp
[DefaultValue(FieldFilterType.Excluded)]
public FieldFilterType FilterType { get; set; }
vb
<DefaultValue(FieldFilterType.Excluded)>
Public Property FilterType As FieldFilterType

Property Value

TypeDefaultDescription
FieldFilterTypeExcluded

A FieldFilterType enumeration value which specifies the field’s filter type.

|

Available values:

NameDescription
Excluded

Specifies that the DXPivotGrid control should not display the filter values. All the other values will be displayed.

| | Included |

Specifies that the DXPivotGrid control should display only the filter values.

|

Remarks

The FilterType property specifies whether only the records that contain values from the PivotGridFieldFilterValues.Values array of a specific field are displayed in a pivot grid.

If the FilterType property is set to the FieldFilterType.Included value, only the records which contain values from the PivotGridFieldFilterValues.Values array of a specific field are displayed by a pivot grid. Otherwise, if the FilterType property is set to the FieldFilterType.Excluded value, only records that don’t contain values from the PivotGridFieldFilterValues.Values array of a specific field are displayed.

Note

The FilterType property is not in effect when you set filter values in the Excel-style pop-up filter.

Example

This example shows how to apply a filter to a field.

The first filter selects records which contain UK in the fieldCountry field, the second filter selects four categories in the fieldCategoryName field: Beverages, Condiments, Seafood, and Produce.

csharp
fieldCountry.SetFilterValues(new string[] { "UK" }, FieldFilterType.Included, true);
    fieldCategoryName.SetFilterValues(new string[] { "Beverages", "Condiments", "Seafood", "Produce" }, FieldFilterType.Included, true);
vb
fieldCountry.SetFilterValues(New String() { "UK" }, FieldFilterType.Included, True)
    fieldCategoryName.SetFilterValues(New String() { "Beverages", "Condiments", "Seafood", "Produce" }, FieldFilterType.Included, True)

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

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.

wpf-pivot-grid-create-context-menu-for-field-values/CS/WpfPivotGrid_CustomMenu/MainWindow.xaml.cs#L40

csharp
object value = menuInfo.FieldValueElementData.Value;
field.FilterValues.FilterType = FieldFilterType.Included;
field.FilterValues.Add(value);

wpf-pivot-grid-implement-a-custom-filter-popup/CS/DXPivotGrid_CustomFilterPopup/CustomFilterEdit.cs#L53

csharp
var values = SelectedItems.OfType<PivotValueInfo>().Select(v => v.Value).ToArray();
if (PivotField.FilterValues.FilterType == FieldFilterType.Included)
    PivotField.FilterValues.ValuesIncluded = values;

wpf-pivot-grid-apply-format-conditions-to-data-cells/CS/WpfPivotGridConditionalFormatting/MainWindow.xaml.cs#L54

csharp
{
    field.FilterValues.FilterType = filterType;
    pivotGridControl1.EndUpdate();

wpf-pivot-grid-create-context-menu-for-field-values/VB/WpfPivotGrid_CustomMenu/MainWindow.xaml.vb#L32

vb
Dim value As Object = menuInfo.FieldValueElementData.Value
field.FilterValues.FilterType = FieldFilterType.Included
field.FilterValues.Add(value)

wpf-pivot-grid-implement-a-custom-filter-popup/VB/DXPivotGrid_CustomFilterPopup/CustomFilterEdit.vb#L63

vb
Dim values = SelectedItems.OfType(Of PivotValueInfo)().Select(Function(v) v.Value).ToArray()
If PivotField.FilterValues.FilterType = FieldFilterType.Included Then
    PivotField.FilterValues.ValuesIncluded = values

See Also

FieldFilterValues Class

FieldFilterValues Members

DevExpress.Xpf.PivotGrid Namespace