Version

Binding xamDataTree to Data

The xamDataTree™ control is a bound tree control; therefore you cannot add nodes directly to it.

Binding the xamDataTree to data requires you to set the xamDataTree control’s ItemsSource property.

The following code shows you how to bind to data in xamDataTree. It uses the DataUtil class provided for you.

In XAML:

<UserControl.Resources>
    <local:DataUtil x:Key="DataUtil" />
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
   <ig:XamDataTree x:Name="MyTree" ItemsSource="{Binding Source={StaticResource DataUtil}, Path=CategoriesAndProducts}">
   </ig:XamDataTree>
</Grid>

In Visual Basic:

MyTree.ItemsSource = DataUtil.CategoriesAndProducts

In C#:

MyTree.ItemsSource = DataUtil.CategoriesAndProducts;

Data Representation

The xamDataTree control uses a NodeLayout object to represent a group/ type of node. This allows for common styling based on the type or data level. For more information, see the xamDataTree Node Layouts topic.

Related Topics