Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
HierarchicalDataTemplate for xamDataTree
posted

Hello, i'm a wpf professional but new to infragistics. So i have a question about templating the xamdatatreee but i found no answer in the documention.

I understand, that you layout/template the xamdatatree with your fieldlayout-mechanism. But xamdatatree understand <DataTemplate>s too. So i try

<ig:XamDataTree
  ItemsSource="{Binding RootItemListe}"
  ItemTemplate="{StaticResource local_TreeViewItemTemplate}"
  />

and as ItemTemplate i'm using is:

<HierarchicalDataTemplate ItemsSource="{Binding Children}" x:Key="local_TreeViewItemTemplate">
  <TextBlock Text="{Binding MyProperty}" />
</HierarchicalDataTemplate>

That works find but you interpret this HierarchicalDataTemplate only as simple <DataTemplate> (it's the baseclass).

Is it possible that you recognice it as <HierarchicalDataTemplate> with the 'ItemsSource'-Property to generate the Childnodes automaticly? That would be the "normal" way of WPF for me....

Thank you for support,

Sascha

Parents
No Data
Reply
  • 5595
    Verified Answer
    posted

    Hi,

    DataTree does not support HierarchicalDataTemplate, it has different mechanism to displaying building hierarchical data:

    1. Using Global Layout definition:

    <ig:XamDataTree.GlobalNodeLayouts>

             <ig:NodeLayout Key="MyCollectionProperty" 

                              DisplayMemberPath="MyProperty" 

                              TargetTypeName="MyType"/>
    </ig:XamDataTree.GlobalNodeLayouts>

    2. Using Nested Layout definition:

    <ig:XamDataTree.NodeLayouts>

    <ig:NodeLayout Key=" MyCollectionProperty"

    DisplayMemberPath="MyProperty"

    TargetTypeName="MyType">

    <ig:NodeLayout.NodeLayouts>

    <ig:NodeLayout Key="MyCollectionProperty"

    DisplayMemberPath="MyProperty"

    TargetTypeName="MyType">

    </ig:NodeLayout>

    </ig:NodeLayout.NodeLayouts>

    </ig:NodeLayout>

    </ig:XamDataTree.NodeLayouts>

    Where:

    • MyType is the type of the objects you would like to see at the corresponding level
    • MyProperty is the property you would like to bind treeitem's header to
    • MyCollectionProperty - the property that contains the data items for the corresponding level

     

    HTH,

Children
No Data