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.v18.2.dll
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.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FieldGeneratorTemplateSelector 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.