Pivot Grid Elements That Support Templates
- 4 minutes to read
The following table lists all template properties introduced by the Pivot Grid:
Visual Element | Property | Description | Data Context (Binding Source) |
---|---|---|---|
Field List | Specifies the template that defines the presentation of the Field List. | ||
Data Cell | PivotGridControl.FieldCellTemplate PivotGridControl.FieldCellTemplateSelector PivotGridControl.FieldCellKpiTemplate | Specifies the template that defines the presentation of data cells. | |
Drag Indicator | Specifies the template that defines the presentation of the drag indicator. | null (Nothing in Visual Basic) | |
Field Header | PivotGridControl.FieldHeaderTemplate | Specifies the template that defines the presentation of field headers. | |
Field Header (in a Field List, list arrangement) | PivotGridControl.FieldHeaderListTemplate PivotGridControl.FieldHeaderListTemplateSelector | Specifies the template that defines the presentation of field headers in the Field List when they are arranged in a list. | |
Field Header (in a Field List, tree arrangement) | PivotGridControl.FieldHeaderTreeViewTemplate PivotGridControl.FieldHeaderTreeViewTemplateSelector | Specifies the template that defines the presentation of field headers in the Field List when they are arranged in a tree. | |
Field Value | PivotGridControl.FieldValueTemplate | Specifies the template that defines the presentation of field values. | |
Focused Cell’s Border | Specifies the template that defines the presentation of the focused cell’s border. | null (Nothing in Visual Basic) | |
Resizing Indicator | Specifies the template that defines the presentation of the resizing indicator. | null (Nothing in Visual Basic) | |
Filter Drop-Down | Specifies the template that defines the presentation of the drop-down filter. | ||
Filter Editor | Specifies the template that defines the presentation of the filter editor. | ||
Filter Editor Dialog Service | Specifies the template that defines the appearance and location of the filter editor window. |
Example
The following example demonstrates how to use the PivotGridControl.FieldCellTemplate property to customize the appearance of data cells.
<Window x:Class="HowToCustomizeCellTemplate.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid"
xmlns:local="clr-namespace:HowToCustomizeCellTemplate"
Title="Custom Cell Template" Height="450" Width="800" Loaded="Window_Loaded">
<Grid>
<dxpg:PivotGridControl x:Name="pivotGridControl1">
<dxpg:PivotGridControl.Fields>
<dxpg:PivotGridField
x:Name="fieldSales"
Area="DataArea"
Caption="Product Sales"
FieldName="ExtendedPrice">
</dxpg:PivotGridField>
<dxpg:PivotGridField
x:Name="fieldYear"
AllowFilter="False"
Area="ColumnArea"
Caption="Year"
FieldName="OrderDate"
GroupInterval="DateYear" />
<dxpg:PivotGridField
x:Name="fieldMonth"
AllowFilter="False"
Area="ColumnArea"
Caption="Month"
FieldName="OrderDate"
GroupInterval="DateMonth" />
<dxpg:PivotGridField
x:Name="fieldCategoryName"
Area="RowArea"
AreaIndex="0"
Caption="Category"
FieldName="CategoryName" />
<dxpg:PivotGridField
x:Name="fieldProductName"
Area="RowArea"
AreaIndex="1"
Caption="Product"
FieldName="ProductName" />
</dxpg:PivotGridControl.Fields>
<dxpg:PivotGridControl.FieldCellTemplate>
<DataTemplate>
<ProgressBar Name="cellShare" Minimum="0" Margin="3"
Maximum="{Binding Path=RowTotalValue, Mode=OneWay, Converter={local:RoundConverter}}"
Value="{Binding Path=Value, Mode=OneWay, Converter={local:RoundConverter}}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
</DataTemplate>
</dxpg:PivotGridControl.FieldCellTemplate>
</dxpg:PivotGridControl>
</Grid>
</Window>