Version

Hierarchical, Heterogenous and Free-Form Data Structures

The DataPresenter architecture supports the consumption and display of hierarchical data, heterogeneous data, and free-form data structures (trees). Heterogeneous data describes a data source that contains records of different types. This is supported based on xamDataPresenter’s™ ability to assign a different FieldLayout to each DataRecord.

Note
Note

There is currently a limitation with regard to multiple FieldLayout support in the controls — the GroupByArea can show only fields from a single FieldLayout: the DefaultFieldLayout. Therefore, grouping is supported only for the DefaultFieldLayout.

Hierarchical data is automatically supported unless the IsNestedDataDisplayEnabled property is set to False. By default, any field that has a DataType that implements the System.Collections.IEnumerable interface, other than string is marked as "expandable". You can explicitly change this by setting the Field's IsExpandable property.

When a Field is marked as expandable, CellValuePresenters are not created to represent the field in the UI. Instead, an ExpandableFieldRecord is created and added to each DataRecord's ChildRecords collection. An ExpandableFieldRecord, like a DataRecord, is not a UIElement™ but rather a lightweight object. It is represented in the UI by a corresponding ExpandableFieldRecordPresenter (for more information, see Performance Optimizations Overview).

If the associated Field's DataType implements the IEnumerable interface, a ChildRecordManager is initialized to create and manage the child DataRecords. In this case, when the ExpandableFieldRecord is expanded, the ExpandableFieldRecordPresenter's NestedContent will contain a RecordListControl containing the child DataRecordPresenters. Otherwise, the NestedContent will contain an ExpandedCellPresenter with the actual cell value.

Note
Note

The FieldSettings object exposes two additional properties that determine the behavior of the ExpandableFieldRecordPresenters: ExpandableFieldRecordExpansionMode and ExpandableFieldRecordHeaderDisplayMode. These two properties are applicable only in Grid view.

Different Views support hierarchical data differently. Therefore, the RecordPresenter-derived classes ( DataRecordPresenter, GroupByRecordPresenter, and ExpandableFieldRecordPresenter) expose a TemplateGridView and a TemplateCardView property to vary their visual trees based on the view.

Here is how different views are handling hierarchical data:

  • Grid view will show an expansion indicator in the RecordPresenter’s UI that is used to toggle its IsExpanded state. Clicking on this expansion indicator will show its nested child records directly beneath its record content.

  • Tree view is presenting hierarchical data with the help of a special "tree-field". This is a field which contains a tree representation of the hierarchical data bound to the control. You have the ability to browse through the nested records' levels by expanding and collapsing them using the designated expansion indicators rendered inside the tree-field.

  • Carousel view is limited to show only sibling records at any one time. However, hierarchical data is supported through a drill-down metaphor that makes use of breadcrumbs to visualize and navigate the drill-down path.

  • Card view is limited to show only sibling records and does not support hierarchical data.