This is a migrated thread and some comments may be shown as answers.

Binding Hierarchical data source to view using Calibrun.Micro

1 Answer 173 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Konrad
Top achievements
Rank 1
Konrad asked on 09 Jan 2014, 10:10 AM
Hi, I'm trying to use RadTreeView with Caliburn.Micro but I can't do basics. Could you show sample project how to bind hierachical data source to TreeView using data from view model using Caliburn.Micro

I have something like this:
        <telerik:RadTreeView x:Name="Nodes" IsDragDropEnabled="True" IsDragTooltipEnabled="False" AllowDrop="True" IsDragPreviewEnabled="False">
            <HierarchicalDataTemplate ItemsSource="{Binding Childs}" DataType="{x:Type viewmodels:TreeListViewModel+Node}">
                <TextBlock Text="{Binding Name}" />
            </HierarchicalDataTemplate>
        </telerik:RadTreeView>

But I get exception: Items collection must be empty before using ItemsSource.

1 Answer, 1 is accepted

Sort by
0
Boris
Telerik team
answered on 10 Jan 2014, 01:07 PM
Hello Konrad,

Usually this kind of exception appears when you try to use both ItemsSource and Items properties of an ItemsControl. You can make a simple test. Use a ListBox, add ListBoxItem to its Items collection and then set the ItemsSource property to some collection of objects. This will lead to the same exception.
So could you please make sure that by the time ItemsSource of the RadTreeView is being set , the Items collection is empty ?

Please let us know if this helps you proceed further.

Regards,
Boris Penev
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
TreeView
Asked by
Konrad
Top achievements
Rank 1
Answers by
Boris
Telerik team
Share this question
or