Version

Displaying Hierarchical Data

Topic Overview

Purpose

This topic explains hierarchical data and how the xamDataGrid ™ control displays it.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic provides an overview of the xamDataGrid control including a conceptual diagram of its comprising elements.

This topic explains the difference between Data Items and Data Records.

This topics explains how to manually define the columns shown for each record.

What is Hierarchical Data

Hierarchical data summary

Hierarchical data organizes information into a tree-like structure of records, consisting of the following parent/child relationships:

  • Parent may have zero or more child records (1:many)

  • Child records may have only one (direct) parent record (1:1)

Hierarchical Data Recognition Process in the Data Presenter

Process summary

The xamDataCarousel ™, xamDataGrid ™, and xamDataPresenter ™ controls can present hierarchical data without making any modifications to the controls. There is no difference between binding the control to a flat or hierarchical data source. The control interpret the data source and display it properly; whether it is flat or hierarchical in nature.

When the control needs to render the data objects it examines their properties’ type and renders depending on their type the properties as described in the table below:

Types Interpretation by the Data Presenter control

All public properties of types that do not implement the IEnumerable interface as well as the String type.

Renders these properties as a cell on the record row.

All public properties of types that implement the IEnumerable interface with the exception of the String type.

Renders these properties as child records, i.e., hierarchically.

This default behavior can be overridden via the IsExpandable property exposed off the Field class. The following table explains how to use the IsExpandable property:

Behavior Set this property To the following value

The data represented by this Field will be rendered as flat (in a cell) or hierarchical (as child records) based on the data type of the Field as explained above.

IsExpandable

null (default)

Force the data for this Field to be displayed inside a cell instead of as child records regardless of the Field’s data type.

Note
Note

In the case where the type is an IEnumerable it is most likely you will want to provide a CellValuePresenter style to render the complex type, e.g. using a sparkline or list perhaps.

IsExpandable

false

Force the data for this Field to be displayed as child records instead of inside a cell regardless of the Field’s data type.

Note
Note

In the case where the type is not an IEnumerable the data will be displayed as a single child record.

IsExpandable

true

You can also use the read-only boolean IsExpandableResolved property to check how a particular Field renders.

Note
Note

The xamDataCards ™ control does not display hierarchical data.

Screenshots of Hierarchical Data Rendered in the Data Presenter

Screenshots summary

The following screenshots shows the xamDataGrid control displaying hierarchical data:

xamDataGrid Data Binding xamDataGrid to Hierarchical SQL Database 01.png
WPF Binding to an Object 01.png

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains how to bind the Data Presenter to an XmlDataProvider.

This topic explains how to bind the Data Presenter to a Collection.

This topic explains how to bind the Data Presenter to a DataSet.

This topic explains how to apply different styles when a cell value changes in a xamDataGrid control.