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.v24.1.dll
NuGet Package: DevExpress.Wpf.PivotGrid
Declaration
Property Value
Type | Description |
---|---|
DataTemplateSelector | A DataTemplateSelector object that is a field template selector. |
Remarks
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.