Version

Field Chooser Overview (xamPivotGrid)

Topic Overview

Purpose

This topic provides an overview of the field chooser control that is part of the xamPivotGrid™.

Required background

The following table lists the topics required as a prerequisite to understanding this topic.

Topic Purpose

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.

After you have loaded a cube with data you need to select hierarchies on which to base the slice of data to be computed.

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.

xamPivotGrid FieldChooser Overview 1.png

Configurable Visual Elements:

  1. 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.

  2. 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.

  3. 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.

Control Configuration Summary

Control configuration overview

The following table lists the main ways to configure the field chooser control.

Configurable aspects Details Properties

Populating the field chooser groups with instances of the FieldChooserItem class.

Using FieldChooserItemsin the field chooser.

Populating the field chooser groups using objects of a custom type.

Using custom type for items in the field chooser.

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.

In order to: Use this property: What to do:

Add items to the columns collection.

Use its Add method to add FieldChooserItems.
OR
Specify the items in XAML inside the Columns property of the FieldChooser.

Set this property to a collection of FieldChooserItems.

Add items to the filters collection.

Use its Add method to add FieldChooserItems.
OR
Specify the items in XAML inside the Filters property of the FieldChooser.

Set this property to a collection of FieldChooserItems.

Add items to the rows collection.

Use its Add method to add FieldChooserItems.
OR
Specify the items in XAML inside the Rows property of the FieldChooser.

Set this property to a collection of FieldChooserItems.

Add items to the measures collection.

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.

In order to: Use this property: What to do:

Add items to the columns collection.

Use its Add method to add FieldChooserItems.
OR
Specify the items in XAML inside the Columns property of the FieldChooser.

Set this property to a collection of FieldChooserItems.

Add items to the filters collection.

Use its Add method to add FieldChooserItems.
OR
Specify the items in XAML inside the Filters property of the FieldChooser.

Set this property to a collection of FieldChooserItems.

Add items to the rows collection.

Use its Add method to add FieldChooserItems.
OR
Specify the items in XAML inside the Rows property of the FieldChooser.

Set this property to a collection of FieldChooserItems.

Add items to the measures collection.

Use its Add method to add FieldChooserItems.
OR
Specify the items in XAML inside the Measures property of the FieldChooser.

Set this property to a collection of FieldChooserItems.

Instruct the field chooser which property of your class holds the unique name string.

Set it to the name of the property of your class.

Instruct the field chooser which property of your class holds a display name for the item.

Set it to the name of the property of your class.

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.

Set it to the name of the property of your class.

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic is a step-by-step walkthrough on using the field chooser control in the xamPivotGrid.

This is a list of the most notable API members relevant to the field chooser control.

This topic is an introduction to the xamPivotDataSelector™ control.