This question is locked. New answers and comments are not allowed.
I would like to produce a table similar to this one: http://www.telerik.com/help/silverlight/gridview-how-to-access-child-gridview.html
However rather than the person object having properties such as FirstName, LastName, Title etc Person would have a collection of Attributes.
Something like
Public class Person
{
Public Person()
{
Id = 2
Children = new ObservableCollection<Person>();
Children.Add(personNancy);
Attributes = new ObservableCollection<Attribute>();
Attributes .Add(new Attribute(){Name = "First Name", Value="Andrew"});
Attributes .Add(new Attribute(){Name = "Last Name", Value="Fuller"});
Attributes .Add(new Attribute(){Name = "Title", Value="Vice President, Sales"});..............
}
public int Id;
public Person parent;
public ObservableCollection<Person> Chldren
{
get, set;
}
public ObservableCollection<Attribute> Attributes
{
get, set;
}
}
For each person I would like to create a cell for each attribute. Is this possible using DataTemplates rather than programming in code behind or view model, I know that I could create a datatable but I would prefer to bind my Person object directly to the Grids Itemssource.
Id | First Name | Last Name | Title
------------------------------------------------------
2 | Andrew | Fuller | Vice President, Sales (can then expand Andrew to find child Nancy)
Id | First Name | Last Name | Title
------------------------------------------------------
1 | Nancy | Davolio | sales Rep
Thank you in advance for any help.
However rather than the person object having properties such as FirstName, LastName, Title etc Person would have a collection of Attributes.
Something like
Public class Person
{
Public Person()
{
Id = 2
Children = new ObservableCollection<Person>();
Children.Add(personNancy);
Attributes = new ObservableCollection<Attribute>();
Attributes .Add(new Attribute(){Name = "First Name", Value="Andrew"});
Attributes .Add(new Attribute(){Name = "Last Name", Value="Fuller"});
Attributes .Add(new Attribute(){Name = "Title", Value="Vice President, Sales"});..............
}
public int Id;
public Person parent;
public ObservableCollection<Person> Chldren
{
get, set;
}
public ObservableCollection<Attribute> Attributes
{
get, set;
}
}
For each person I would like to create a cell for each attribute. Is this possible using DataTemplates rather than programming in code behind or view model, I know that I could create a datatable but I would prefer to bind my Person object directly to the Grids Itemssource.
Id | First Name | Last Name | Title
------------------------------------------------------
2 | Andrew | Fuller | Vice President, Sales (can then expand Andrew to find child Nancy)
Id | First Name | Last Name | Title
------------------------------------------------------
1 | Nancy | Davolio | sales Rep
Thank you in advance for any help.