I want to bind nested collection to grid panel but not sure how dynamically I can do this.
Here is my collection:
Public class GrandParent
{
string name;
Icollection<Parent> ParentCollection;
}
Public class Parent
{
string lastname;
Icollection<Child> ChildCollection;
}
Public class Child
{
string name;
int age;
}
I want output like this:
GrandParent.Name Parent1.LastName Parent2.LastName Parent3.LastName
GP1 Children[GP1,Parent1.LastName] Children[GP1,Parent2.LastName] Children[GP1,Parent3.LastName]
GP2 Children[GP2,Parent1.LastName] Children[GP2,Parent2.LastName] Children[GP2,Parent3.LastName]
Where Parent.LastNames are static.
As of now, my viewmodel class (binding class) is like this:
Class viewmodel
{
collection<string> GrandParentNames
{
}
collection<string> Parent1LastNames
{
}
collection<string> Parent2LastNames
{
}
collection<string> Parent3LastName
{
}
}
Could anyone please suggest me better approach with this?