Version

Node Binders

Before You Begin

When binding to data, the xamTreemap™ control needs to understand the data. This is done with node binders.

The NodeBinder class has properties that indicate how the data should be read:

  • TextPath - determines the name of the property of the data source that contains text information.

  • ValuePath – determines the name of the property of the data source that contains the data.

  • TargetTypeName – determines the type of the data that is pointed by ValuePath.

  • ItemsSourcePath – if the data source is of hierarchical type, ItemsSourcePath is the name of the property that points to the child nodes.

  • NodeStyle – the nodes to which the NodeBinder binds will inherit the style specified by the NodeStyle property. Note that every NodeBinder can have a different NodeStyle.

Example

We have the following classes: Manufacturer, Product and InventoryEntry. The Product class contains a List of InventoryEntry items, and the Manufacturer class contains a list of Product items.

xamTreemap Node Binders 01.png

We will now set the xamTreemap control to display the list of Manufacturer items from our data source.

The snippet shows three node binders – each binder applies to one of the classes (Manufacturer, Product and InventoryEntry).

In XAML:

<ig:xamTreemap.NodeBinders>
    <ig:NodeBinder
        TargetTypeName="Manufacturer"
        ValuePath="Revenue"
        TextPath="Name"
        ItemsSourcePath="Products" />
    <ig:NodeBinder
        TargetTypeName="Product"
        ValuePath="StandardCost"
        TextPath="Name"
        ItemsSourcePath="InventoryEntries" />
    <ig:NodeBinder
        TargetTypeName="InventoryEntry"
        ValuePath="Quantity"
        TextPath="Shelf" />
</ig:xamTreemap.NodeBinders>
xamTreemap Node Binders 02.png