Building on my previous post where I talked about how to bind data to the RadGridView, today I want to show how you can display hierarchical data in the grid. I will follow the same concept of building an application for a car repair shop to manage vehicles in for repair. I will leverage two classes to display the data. The original Car class which was used previously and a new CustomerComplaint class. The Complaint property of the Car object was initially a string, but we need to allow for several issues to be reported so we will use the CustomerComplaint class to extend that capability. The Complaint property has been changed to type List<CustomerComplaint> and renamed to Complaints in this scenario.
So in my previous example we created a routine called GetCarsInTheShop which returned a list of Car objects. In this example, I have modified that same routine to create some CustomerComplaints and attach them to the Car. Other than that the routine is unchanged.
I then use the same code to bind the data to the RadGridView when the Window initializes.
After running the code you will see that we do not get our Complaint data displayed, but rather we see "(Collection)" displayed. We need to let the RadGridView know that a hierarchy exists in the data.
You will need to setup the PropertyRelationship for the Complaints property to identify what the hierarchy is based on.
Once we run the code, there are now plus symbols at the head of each row. When you click the plus it will expand the row to show the hierarchy information.
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.