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
405
Databind simple tree with one root node?
posted

I have a viewmodel with ObservableCollection<PersonViewModel> on it.  PersonViewModel.Name is what I want to show.

I want a tree bound and showing  the person names, but I want a root node called "Person Root" (so one collapsible root with names under it)

-Person Root

  +Greg

  +Tom

etc.

Is this possible in xaml with data binding without modifying my viewmodel structure?

Parents
  • 5595
    Verified Answer
    posted

    Hi,

    Did you try something like the following XAML:

    <igTree:XamWebTree x:Name="TestXamWebTree">

                <igTree:XamWebTreeItem Header="Person Root" ItemsSource="{Binding}">

                    <igTree:XamWebTreeItem.ItemTemplate>

                        <DataTemplate>

                            <TextBlock Text="{Binding Name}"/>

                        </DataTemplate>

                    </igTree:XamWebTreeItem.ItemTemplate>

                </igTree:XamWebTreeItem>

            </igTree:XamWebTree>

     

    HTH,

Reply Children