Template for nested List

Hello. This is a small example of my setup:

public List<Parent> Parents {get;set;} = [];

public class Parent{

public int Id {get, set;}

public string Name {get;set;}

public List<Child> Children {get; set;}

}

public class Child{

public string Name {get;set;}

}

How to create a ListView where I can see the names of all Parent objects in the Parents list. And if I click on one name, all Names of the Childs are listed, if the Children List is not empty.

The example in the documentation uses the same class for parent and child, so I was not able to modify it for my usecase.


1 Reply

LD LeoLavanya Dhanaraj Syncfusion Team June 5, 2024 06:02 PM UTC

Hi Alexander,


Greetings from Syncfusion support.


Based on the details shared, it is understood that you want to use two different classes for parent and child items in the nested ListView component. However, our nested list navigation is achieved through the Child property, which should be defined within the same class for the nested list in the array of JSON. Therefore, we recommend using the same approach to fulfill your nested list requirements in your application. Additionally, please provide the specific use case for using individual classes for parent and child items in the ListView component. Once we have more information from your end, we will validate and offer a timely solution.


Regards,

Leo Lavanya Dhanaraj


Loader.
Up arrow icon