Class TreeMap
Represents a control which can display hierarchical data as a set of nested rectangles. Each item in the hierarchy is laid out in a rectangular area of a size proportional to the value associated with the item.
Inherited Members
Namespace: System.Windows.Controls.DataVisualization
Assembly: Controls.DataVisualization.OpenSilver.dll
Syntax
public class TreeMap : Control
Remarks
You populate a TreeMap by setting its ItemsSource property to the root of the hierarchy you would like to display. The ItemDefinition property must be set to an instance of a TreeMapItemDefinition with appropriate bindings for Value (identifying the value to be used when calculating relative item sizes) and ItemsSource (identifying the collection of children for each item).
Constructors
| Improve this Doc View SourceTreeMap()
Initializes a new instance of the TreeMap class.
Declaration
public TreeMap()
Fields
| Improve this Doc View SourceInterpolatorsProperty
Identifies the Interpolators dependency property.
Declaration
public static readonly DependencyProperty InterpolatorsProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ItemDefinitionProperty
Identifies the ItemDefinition dependency property.
Declaration
public static readonly DependencyProperty ItemDefinitionProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ItemDefinitionSelectorProperty
Identifies the ItemDefinitionSelector dependency property.
Declaration
public static readonly DependencyProperty ItemDefinitionSelectorProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
ItemsSourceProperty
Identifies the ItemsSource dependency property.
Declaration
public static readonly DependencyProperty ItemsSourceProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceInterpolators
Gets or sets a value representing a collection of interpolators to use in TreeMap.
Declaration
public Collection<Interpolator> Interpolators { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.ObjectModel.Collection<Interpolator> |
ItemDefinition
Gets or sets a value representing the template used to display each item.
Declaration
public TreeMapItemDefinition ItemDefinition { get; set; }
Property Value
Type | Description |
---|---|
TreeMapItemDefinition |
ItemDefinitionSelector
Gets or sets the selector used to choose the item template dynamically.
Declaration
public TreeMapItemDefinitionSelector ItemDefinitionSelector { get; set; }
Property Value
Type | Description |
---|---|
TreeMapItemDefinitionSelector |
ItemsSource
Gets or sets a value representing the list of hierarchies used to generate content for the TreeMap.
Declaration
public IEnumerable ItemsSource { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.IEnumerable |
Methods
| Improve this Doc View SourceArrangeOverride(Size)
Performs the Arrange pass of the layout.
Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
Type | Name | Description |
---|---|---|
Size | finalSize | The final area within the parent that this element should use to arrange itself and its children. |
Returns
Type | Description |
---|---|
Size | The actual size used. |
Overrides
Remarks
We round rectangles to snap to nearest pixels. We do that to avoid anti-aliasing which results in better appearance. Moreover to get correct layout we would need to use UseLayoutRounding=false which is Silverlight specific. A side effect is that areas for rectangles in the visual tree no longer can be used to compare them as dimensions are not rounded and therefore not precise.
GetContainerForItemOverride(Object, Int32)
Constructs a new instance of an element used to display an item in the tree.
Declaration
protected virtual FrameworkElement GetContainerForItemOverride(object data, int level)
Parameters
Type | Name | Description |
---|---|---|
System.Object | data | One of the items in the ItemsSource hierarchy. |
System.Int32 | level | The level of the item in the hierarchy. |
Returns
Type | Description |
---|---|
FrameworkElement | A new FrameworkElement which will be added to the TreeMap control. If this method returns null the TreeMap will create the item using the ItemDefinition property, or the value returned by TreeMapItemDefinitionSelector if specified. |
Remarks
By default TreeMap will use the template set in its ItemDefinition property, or the value returned from GetTemplateForItemOverride if overridden. Override this method to build a custom element.
OnApplyTemplate()
Invoked whenever application code or internal processes call ApplyTemplate. Gets references to the template parts required by this control.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnInterpolatorsPropertyChanged(Collection<Interpolator>, Collection<Interpolator>)
Called when the value of the InterpolatorsProperty property changes. Triggers a recalculation of the layout.
Declaration
protected virtual void OnInterpolatorsPropertyChanged(Collection<Interpolator> oldValue, Collection<Interpolator> newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ObjectModel.Collection<Interpolator> | oldValue | The old Interpolators collection. |
System.Collections.ObjectModel.Collection<Interpolator> | newValue | The new Interpolators collection. |
OnItemDefinitionPropertyChanged(TreeMapItemDefinition, TreeMapItemDefinition)
Called when the value of the ItemDefinitionProperty property changes. Triggers a recalculation of the layout.
Declaration
protected virtual void OnItemDefinitionPropertyChanged(TreeMapItemDefinition oldValue, TreeMapItemDefinition newValue)
Parameters
Type | Name | Description |
---|---|---|
TreeMapItemDefinition | oldValue | The old item definition. |
TreeMapItemDefinition | newValue | The new item definition. |
OnItemDefinitionSelectorPropertyChanged(TreeMapItemDefinitionSelector, TreeMapItemDefinitionSelector)
Called when the value of the ItemDefinitionSelectorProperty property changes. Triggers a recalculation of the layout.
Declaration
protected virtual void OnItemDefinitionSelectorPropertyChanged(TreeMapItemDefinitionSelector oldValue, TreeMapItemDefinitionSelector newValue)
Parameters
Type | Name | Description |
---|---|---|
TreeMapItemDefinitionSelector | oldValue | The old selector. |
TreeMapItemDefinitionSelector | newValue | The new selector. |
OnItemsSourcePropertyChanged(IEnumerable, IEnumerable)
Called when the value of the ItemsSourceProperty property changes.
Declaration
protected virtual void OnItemsSourcePropertyChanged(IEnumerable oldValue, IEnumerable newValue)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerable | oldValue | The old ItemsSource collection. |
System.Collections.IEnumerable | newValue | The new ItemsSource collection. |