RadTreeView Binding Problem

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    17 posts
    Member since:
    Feb 2011

    Posted 27 Apr 2011 Link to this post

    I have these two classes

    public class CustomerModel : _BaseModel
        public int CustomerId { get; set; }
        public string CustomerCode { get; set; }
        public string CustomerName { get; set; }
        public List<ProjectModel> Projects { get; set; }


    public class ProjectModel : _BaseModel
        public int ProjectId { get; set; }
        public int UserId { get; set; }
        public int CustomerId { get; set; }
        public WarehouseModel PrimaryWarehouse { get; set; }
        public WarehouseModel SecondaryWarehouse { get; set; }
        public ProjectType ProjectType { get; set; }
        public string ProjectName { get; set; }
        public string ProjectNum { get; set; }
        public DateTime Date { get; set; }
        public string Comments { get; set; }

    and my XAML:

        <DataTemplate x:Key="Project">
            <TextBlock Text="{Binding ProjectName}" />
        <HierarchicalDataTemplate x:Key="Customer" 
                                    ItemTemplate="{StaticResource Project}"
                                    ItemsSource="{Binding Customers}">
            <TextBlock Text="{Binding CustomerName}" />


    <telerik:RadTreeView ItemsSource="{Binding Customers}"
                  ItemTemplate="{StaticResource Customer}"/>

    When I run it, I see the Customer nodes, but not the Project nodes
  2. Petar Mladenov
    Petar Mladenov avatar
    3148 posts

    Posted 02 May 2011 Link to this post

    Hi Kevin,

    I guess the reason could be that in XAMl, you have specified the ItemsSource of the HierarchicalDataTemplate incorrectly. I think it should be "Projects" instead of Customers. Please check out the attached project for further reference.

    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top