Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1655
How to presenting hierarchical data in the xamDataGrid
posted

Hi,

I have two Entity classes. Those are Department and Users and are defined as shown below.

class Department
{
    int DepartmentID;
    User user;
}

class User
{
    string FirstName;
    string LastName;

}

i am assigning value of user to the department class and returning it back.

like

{

        Department dept = new Department();

        User u = new User();

        dept.DepartmentID = 4875;

        u.FirstName = "Robert";

        u.LastName = "Parera";

        dept.User=u;

        return dept;

}

At the UI layer I want to bind this data to the XamDataGrid.

while creating fields i am setting DataSource property to the dept object.

dgDetails.DataSource=dept;

Now i am creating field then  i am able to show the details of the department like DepartmentID but i am not able to show the user details from the dept object.

Can you please let me know if there is any way bind this data?

  • 69686
    posted

    Hello,

    In this case you should use UnboundField and set its BindingPath property to "user.FirstName".

    Still, I am not sure how you set the DataSource of the XamDataGrid to an object that is not a collection (dept).

    You are probably using the DataItems.Add()  or a collection of department object.

    Please let me know if you have any questions on this.