Skip to main content

PivotGridControl.FieldGeneratorTemplateSelector Property

Gets or sets the data template selector which chooses a template based on the field’s type. This is a dependency property.

Namespace: DevExpress.Xpf.PivotGrid

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

NuGet Package: DevExpress.Wpf.PivotGrid


public DataTemplateSelector FieldGeneratorTemplateSelector { get; set; }

Property Value

Type Description

A DataTemplateSelector object that is a field template selector.


The DevExpress WPF PivotGridControl supports field binding. The Pivot Grid can be bound to a collection of objects containing field settings, described in a Model or ViewModel. The PivotGridControl generates fields based on field templates. Using a single template, you can create an unlimited number of fields in an unlimited number of Pivot Grid controls.

To choose the required field template, use the Data Template Selector assigned to the FieldGeneratorTemplateSelector property.

public class FieldTemplateSelector : DataTemplateSelector {
        public override DataTemplate SelectTemplate(object item, DependencyObject container) {
            Field field = (Field)item;
            if(field.Interval == FieldGroupInterval.DateYear) {
                return (DataTemplate)((Control)container).FindResource("IntervalFieldTemplate");
            return (DataTemplate)((Control)container).FindResource("DefaultFieldTemplate");

To learn more, see Binding to a Collection of Fields.

See Also