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

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

2 Answers 41 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
jiang
Top achievements
Rank 1
jiang asked on 27 Dec 2010, 03:52 AM

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 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 28 Dec 2010, 04:21 PM
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
0
Jiang
Top achievements
Rank 1
answered on 29 Dec 2010, 03:20 AM
Thank you for your help!
I solve this problem.
Tags
TreeView
Asked by
jiang
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Jiang
Top achievements
Rank 1
Share this question
or