TreeMapHierarchicalDataAdapter Class
A data adapter that allows you to provide hierarchical data to the Tree Map.
Namespace: DevExpress.Xpf.TreeMap
Assembly: DevExpress.Xpf.TreeMap.v19.1.dll
Declaration
public class TreeMapHierarchicalDataAdapter :
TreeMapDataAdapterBase,
ISupportNativeSource,
INativeItemsCollector
Remarks
This class introduces the TreeMapHierarchicalDataAdapter.DataSource property allowing you to specify the data source provided to the Tree Map and the TreeMapHierarchicalDataAdapter.ValueDataMember property that allows you to specify which data member is used as a value provider.
Example
To provide hierarchical data to the Tree Map, do the following.
- Assign a newly created
TreeMapHierarchicalDataAdapter
to the TreeMapControl.DataAdapter property. - Specify the adapter’s TreeMapHierarchicalDataAdapter.DataSource and TreeMapHierarchicalDataAdapter.ValueDataMember properties.
- Create Data Templates that will be used to represent the hierarchical data items.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-provide-hierarchical-data-to-the-tree-map-t308576.
<Window.Resources>
<HierarchicalDataTemplate
DataType="{x:Type local:SideOfWorld}"
ItemsSource="{Binding Countries}">
<TextBlock
Margin="4,4,4,-3"
Padding="4,2,0,2"
Text="{Binding Name}"
Foreground="White"
Background="Gray"/>
</HierarchicalDataTemplate>
<DataTemplate
DataType="{x:Type local:Country}">
<Grid>
<TextBlock
Padding="4,2,0,0"
Text="{Binding Name}"
TextWrapping="WrapWithOverflow"
TextTrimming="WordEllipsis"/>
<Border
BorderThickness="1"
BorderBrush="#60000000"/>
</Grid>
</DataTemplate>
</Window.Resources>
<Grid>
<dxtm:TreeMapControl>
<dxtm:TreeMapControl.Colorizer>
<dxtm:TreeMapPaletteColorizer>
<dxtm:Office2013Palette/>
</dxtm:TreeMapPaletteColorizer>
</dxtm:TreeMapControl.Colorizer>
<dxtm:TreeMapHierarchicalDataAdapter
DataSource="{Binding}"
ValueDataMember="Gdp">
</dxtm:TreeMapHierarchicalDataAdapter>
</dxtm:TreeMapControl>
</Grid>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the TreeMapHierarchicalDataAdapter class.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.