DlhSoft Hierarchical Data Light Library Documentation

for Silverlight™ 4+, and Windows® Presentation Foundation (WPF) and .NET Framework 4+

Get started

Initialization

1.       Add the necessary DlhSoft.* assembly references to your application project from Solution Explorer section of Visual Studio®.
Reference the appropriate namespaces in code with xmlns attributes for the XAML root element and/or using clauses in code behind:

<Window […]
        xmlns:hdc = "clr-namespace:DlhSoft.Windows.Controls;assembly=DlhSoft.HierarchicalData.LightWPF.Controls">

using DlhSoft.HierarchicalData.LightWPF.Controls;

2.       Add the required control instances as child nodes of appropriate XAML container elements or create component objects in code behind:

<DockPanel>
    […]
    <hdc:DataTreeGrid x:Name="DataTreeGrid" […]/>
</DockPanel>

var dataTreeGrid = new DataTreeGrid {[…]};
dockPanel.Children.Add(dataTreeGrid);

Data binding

3.       To load and present data items within DataTreeGrid component instances initialize their Items collections (with a single setter or Add method calls).
Define DataTreeGridItem objects providing these properties:

§  Content values usually specify node names;

§  Indentation values generate the structure of the hierarchy (parent and child nodes):

var item1 = new DataTreeGridItem { Content = "My parent node" […] };
var item2 = new DataTreeGridItem { Content = "My child node", Indentation = 1 };
DataTreeGrid.Items = new ObservableCollection<DataTreeGrid> { item1, item2 };

var item3 = new DataTreeGridItem { Content = "Another child node", Indentation = 1 };
DataTreeGrid.Items.Add(item3);

4.       You may supplementary customize items using classic inheritance and new properties, if needed:

public class CustomDataTreeGridItem : DataTreeGridItem
{
    public string Description { get; set; }
}

DataTreeGrid.Items.Add(
    new CustomDataTreeGridItem { Content = "My node", Description = "My node’s description" });

5.       To customize the displayed grid columns, use the Columns property of the component.
To display hierarchical content use the DataTreeGridColumn object.
You may also refer custom item properties from bindings and data templates:

<hdc:DataTreeGrid.Columns>
    <hdc:DataGridColumnCollection>
        <hdc:DataTreeGridColumn   Header="Node"/>
        <d:DataGridTextColumn     Header="Details" Binding="{Binding Description}">
        <d:DataGridTemplateColumn Header="Details">
            <d:DataGridTemplateColumn.DataTemplate>
                <TextBox Text="{Binding Description}"/>
            </d:DataGridTemplateColumn.DataTemplate>
        </d:DataGridTemplateColumn>
        […]
    </hdc:DataGridColumnCollection>
</hdc:DataTreeGrid.Columns>

6.       If needed (such as if you use an MVVM based approach), you may use our generic built-in item collection converters (or provide custom converter implementations instead) to bind Items collections directly to your business logic or data layers, referring the actual Member properties that the component should manage from your data items that can be referred as Tag objects of component items:

<hdc:DataTreeGrid.Items>
    <Binding>
        <Binding.Converter>
            <hdc:NodeItemsConverter ContentMember="Name" IndentationMember="IndentLevel"
                                    UpdateTargetOnSourceChanges="True" UpdateSourceOnTargetChanges="True"/>
        </Binding.Converter>
    </Binding>
</hdc:DataTreeGrid.Items>

<d:DataGridTextColumn Header="Details" Binding="{Binding Tag.Description}">

Settings

7.       When needed, you can configure the expander templates using XAML:

<hdc:DataTreeGrid […]
    ExpanderTemplate = "{StaticResource CustomExpanderTemplate}"/>

8.       To further configure the look and feel, behavior, and other aspects of the components use their other member properties (see also Demo source code):

DataTreeGrid.IsAsyncPresentationEnabled = false;

Operations

9.       To get the root or leaf nodes from the managed collection:

foreach (var root in DataTreeGrid.GetRoots()) {[…]};
foreach (var leaf in DataTreeGrid.GetLeaves()) {[…]};

10.   To get the parent, or enumerate ascendants, children, or descendants of a specific node item:

var parent = DataTreeGrid.GetParent(item);
foreach (var ascendant in DataTreeGrid.GetAllParents(item)) {[…]};
foreach (var child in DataTreeGrid.GetChildren(item)) {[…]};
foreach (var descendant in DataTreeGrid.GetAllChildren(item)) {[…]};

11.   Other member methods and events are available to provide advanced operations with the components and the data items they manage (see also Demo source code):

DataTreeGrid.Move(item, toIndex, includeChildren: false);
DataTreeGrid.MoveUp(item, includeChildren: true, withinParent: true);
DataTreeGrid.MoveDown(item, includeChildren: true, withinParent: true);

DataTreeGrid.ItemPropertyChanged += (sender, e) {[…]};
DataTreeGrid.ItemCollectionChanged += (sender, e) {[…]};

Resources

Downloads

·         Standard build (includes supplemental documentation)

·         Rebuild for .NET 4.5, Silverlight™ 5

Reference documentation

·         Controls

Sample applications

·         Silverlight™

·         WPF

Licensing

·         Technical information

·         Purchase page