Skip to main content
Tag

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PivotGridField.TopValueShowOthers Property

Gets or sets whether the “Others” item is displayed within the PivotGridControl when the Top N Values feature is enabled. This is a dependency property.

Namespace: DevExpress.Xpf.PivotGrid

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

NuGet Package: DevExpress.Wpf.PivotGrid

#Declaration

public bool TopValueShowOthers { get; set; }

#Property Value

Type Description
Boolean

true if the “Others” item is displayed when the Top N Values feature is enabled; otherwise, false.

#Remarks

The PivotGridField.TopValueCount property can be used to restrict the number of field values displayed along the control’s left or top edge. Setting this property to a positive value enables the Top N Values feature. In this case, the control displays the first field values according to the current sort order, the number of these values is defined by the PivotGridField.TopValueCount property. If the TopValueShowOthers property is set to false the values that follow the first values are hidden. If this property is set to true the remaining values will be combined into a single item (“Others”).

The default “Others” substring can be localized. See the Localizing WPF Controls via Localizer Objects document for more information. Another way to customize the “Others” header is to handle the PivotGridControl.FieldValueDisplayText event.

#Example

This example demonstrates how to avoid browsing an entire report, but only show the best or worst results. For this purpose, the PivotGridControl provides the Top N Values feature, which can be used to limit the number of displayed field values to the specified number of topmost values according to the sort order.

To enable this feature, the PivotGridField.TopValueCount property must be used. This property allows you to restrict the number of field values that are displayed along the column or row axis.

<Window x:Class="HowToBindToMDB.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
        Title="MainWindow" Height="350" Width="525"  Loaded="Window_Loaded">
    <Grid Margin="7">
        <dxpg:PivotGridControl HorizontalAlignment="Left" Name="pivotGridControl1"
                               VerticalAlignment="Top">
            <dxpg:PivotGridControl.Fields>
                <dxpg:PivotGridField x:Name="fieldCountry" FieldName="Country" Area="RowArea"/>
                <dxpg:PivotGridField x:Name="fieldCustomer" FieldName="Sales Person" Area="RowArea"
                                     SortByField="{Binding ElementName=fieldExtendedPrice}"
                                     Caption="Customer" TopValueCount="3"
                                     TopValueShowOthers="True"
                                     SortOrder="Descending"/>
                <dxpg:PivotGridField x:Name="fieldExtendedPrice" FieldName="Extended Price"
                                     Area="DataArea" CellFormat="c0" />
            </dxpg:PivotGridControl.Fields>
        </dxpg:PivotGridControl>
    </Grid>
</Window>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TopValueShowOthers 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.

See Also