Binding Hierarchical data source to view using Calibrun.Micro

2 posts, 0 answers
  1. Konrad
    Konrad avatar
    33 posts
    Member since:
    Aug 2010

    Posted 09 Jan 2014 Link to this post

    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}" />

    But I get exception: Items collection must be empty before using ItemsSource.
  2. Boris
    Boris avatar
    276 posts

    Posted 10 Jan 2014 Link to this post

    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.

    Boris Penev
    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top