This section serves as an introduction to the xamPivotGrid control’s key features and functionalities. The topics listed here will give you a better idea of why you would want to use xamPivotGrid in your applications.
This topic demonstrates how to get started with the xamPivotGrid control by providing step-by-step procedure for adding this control to a WPF application.
Visual Elements of the Field Chooser Control and Related Properties
Visual elements summary
The field chooser is a part of the xamPivotGrid that allows you to specify items which users can pick from to use as rows, columns, filters and measures in the pivot grid. It consists of four ItemsControls, where selectable items can be specified for rows, columns, filters and measures. The purpose of the field chooser is somewhat similar to this of the xamPivotDataSelector™.
The following screenshot depicts the visual elements of the field chooser control. Configurable elements are listed after the image.
Configurable Visual Elements:
Field Chooser drop-down
This is how the field chooser looks, when its drop-down is displayed. To display the drop-down, press the button above it.
Rows Group Header
Each of the four groups of items has a header that you can set to an object of your choice. In the screenshot above, the headers are set to TextBlocks with the corresponding text for each group - Rows, Columns, Filters and Measures.
Columns field chooser group
All of the field chooser groups are optional and if no items are added to a group it will not be displayed.
Visual elements and related properties
The following table maps the visual elements of the field chooser control and the properties that configure them.
Populating the Field Chooser Groups with Instances of the FieldChooserItem Class
Overview
FieldChooserItem is a ContentControl and it is the default type for items of the FieldChooserGroups. The relation between FieldChooserItem and FieldChooserGroup is similar to ComboBoxItem and ComboBox – if you add items from a custom type to a field chooser group each of them will be implicitly wrapped inside a FieldChooserItem.
The FieldChooserItem class exposes the FieldUniqueName property which determines what hierarchy/measure the item corresponds to. For all groups except Measures, this property needs to be set to the UniqueName of the Hierarchy that you want to target. For measures, the FieldUniqueName should match the corresponding UniqueName property of the Measure you want to target.
Property settings
The following table maps the desired configuration to property settings.
Use its Add method to add FieldChooserItems. OR
Specify the items in XAML inside the Measures property of the FieldChooser.
Populating the Field Chooser Groups Using Objects of a Custom Type
Overview
When you want to use some custom class for the items in field chooser groups there are the following important requirements:
The class must have a string property where the unique name string will be stored.
You need to create mapping for the unique name property. To do so, you need to set the FieldUniqueNameMemberPath property of the FieldChooser to the name of the property in your class that holds the unique name string. For example, you have a TestItem class which has a string property called HierarchyName. Also assume that you have a Hierarchy with UniqueName"[Seller].[Seller]". If you want to enable users to add/remove this hierarchy from the Columns area of the xamPivotGrid through the field chooser, you need to set the FieldUniqueNameMemberPath property of the field chooser to HierarchyName. Then you have to create a TestItem instance with its HierarchyName set to [Seller].[Seller] and add it to the column field group.
Property settings
The following table maps the desired configuration to property settings.
Instruct the field chooser which property of your class holds an integer value used for determining at what position the item is added to the target collection.