How can I achieve multi-layer structure in TreeView that use DataBinding?

3 posts, 0 answers
  1. jiang
    jiang avatar
    10 posts
    Member since:
    Dec 2010

    Posted 26 Dec 2010 Link to this post

    hello:
    the multi-layer structure code:

    public class Company
    {
        public Company(string _name, Guid _companyId)
        {
            Name = _name;
            CompanyId = _companyId;
            this.BusinessUnits = new List<BusinessUnit>();
        }
        public override string ToString()
        {
            return this.Name;
        }
        public string Name { get; set; }
        public Guid CompanyId { get; set; }
        public List<BusinessUnit> BusinessUnits { get; set; }
    }
    public class BusinessUnit
    {
        public BusinessUnit(string _name, Guid _unitId,string _path)
        {
            Name = _name;
            UnitId = _unitId;
            Path = _path;
            this.Users = new List<User>();
            this.ChildBusinessUnits = new List<BusinessUnit>();
        }
        public override string ToString()
        {
            return this.Name;
        }
        public string Path { get; set; }
        public string Name { get; set; }
        public Guid UnitId { get; set; }
        public List<User> Users { get; set; }
        public List<BusinessUnit> ChildBusinessUnits { get; set; }
    }
    public class User
    {
        public User(string _name, Guid _userId, string _path)
        {
            Name = _name;
            UserId = _userId;
            Path = _path;
        }
        public override string ToString()
        {
            return this.Name;
        }
        public string Name { get; set; }
        public Guid UserId { get; set; }
        public string Path { get; set; }
    }

    How can I achieve ???
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 28 Dec 2010 Link to this post

    Hello jiang,

    Please check out the attached solution demonstrating the use of DataTemplateSelectors. Hope this fits in your scenario. Feel free to ask if you need more info.

    Kind regards,
    Petar Mladenov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Jiang
    Jiang avatar
    1 posts
    Member since:
    Nov 2010

    Posted 28 Dec 2010 Link to this post

    Thank you for your help!
    I solve this problem.
Back to Top