Rad Domain Data Service + TreeListView Binding

5 posts, 1 answers
  1. Jill
    Jill avatar
    20 posts
    Member since:
    Nov 2010

    Posted 13 Jan 2011 Link to this post

    Hi Support,

    Can the TreeListView bind to the new RadDomainDataSource control? I ask because I am trying to bind it and all I get is the top tier of items in my collection.

    XML looks like this;
    <telerik:RadTreeListView x:Name="ActionThreadTreeView" Grid.Row="1" ItemsSource="{Binding DataView, ElementName=ddsCommentActivities}">
     
    <telerik:RadTreeListView.ChildTableDefinitions>
      <telerik:TreeListViewTableDefinition ItemsSource="{Binding Children}" />
    </telerik:RadTreeListView.ChildTableDefinitions>
     
    <telerik:RadTreeListView.Columns>
     I define columns here.
    </telerik:RadTreeListView.Columns>
     
    </telerik:RadTreeListView>

    ddsCommentActivities is my RDDS. I'm returning a List<TreeviewHierarchy> which looks like this;
    public class TreeviewHierarchy
    {
        public TreeviewHierarchy()
        {
            //Create new childrens class so that it's not null.
            Children = new List<TreeviewHierarchy>();
        }
     
        public TreeviewHierarchy( int id, string actName, string actStatusName, string applStatusName, Nullable<System.DateTime> applStatusDate )
        {
            Id = id;
            ActivityName = actName;
            ActivityStatusName = actStatusName;
            ApprovalStatusName = applStatusName;
            ApprovalStatusDateTime = applStatusDate;
     
            //Create new childrens class so that it's not null.
            Children = new List<TreeviewHierarchy>();
        }
     
        [Key]
        public int Id { get; set; }
        public string ActivityName { get; set; }
        public string ActivityStatusName { get; set; }
        public string ApprovalStatusName { get; set; }
        public Nullable<System.DateTime> ApprovalStatusDateTime { get; set; }
        public IList<TreeviewHierarchy> Children { get; set; }
    }

    I feel this list with data, right now testing four levels deep meaning, one parent->child->child->child. I would think I would see the TreeListView control displaying the data but it only shows the "parent" and no drop down selector. Am I doing something wrong?

    Thanks in advance!
  2. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 14 Jan 2011 Link to this post

    Hello Chris,

    After reading this article, can you verify that the child records are actually on the client?

    You can remove the RDDS and the TreeListView and simply pull the data with a DomainContext.Load call. You can then debug the object graph in order to see whether the entire hierarchy has been brought to the client.

    You can read about this feature here:
    We are looking forward to hearing from you.

    Kind regards,
    Ross
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Jill
    Jill avatar
    20 posts
    Member since:
    Nov 2010

    Posted 14 Jan 2011 Link to this post

    Ross,

    Thank you for this information. As soon as I can try it I will let you know if it works. Right now adding the attribute tag gives me a visual studio 2010 error;

    The type 'System.ComponentModel.DataAnnotations.CompositionAttribute' exists in both 'C:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Server\System.ServiceModel.DomainServices.Server.dll' and 'C:\Program Files (x86)\Microsoft SDKs\RIA Services\v1.0\Libraries\Silverlight\System.ServiceModel.DomainServices.Client.dll'

    I have "using System.ComponentModel.DataAnnotations;" "using System.ServiceModel.DomainServices.Server;" at the top of my code.
  5. Jill
    Jill avatar
    20 posts
    Member since:
    Nov 2010

    Posted 14 Jan 2011 Link to this post

    Ross,

    You were right, the children were not appearing on the client side. I added the [Include] tag and the [Association("","","")] tag and now the children are shown on the client side.

    I get the expander now on the first column. It won't show the lines below it but I think there is something I'm not doing right.
  6. Jill
    Jill avatar
    20 posts
    Member since:
    Nov 2010

    Posted 14 Jan 2011 Link to this post

    Ross,

    Expander is working now. I had an issue with my association going off the same column in the parent and child. Not sure why I typed that and not the childs parent Id field name lol!

    Anyway thanks for all the help and the quick responses. You guys are great!

    Thanks,
Back to Top
DevCraft banner