Hello,
I have an Entity, Company, that has a property exposing a list of child entities, Car.
For a quick run I created an instance of my Entity:
Company company = new Company() { Name = "Ford", City = "Detroit" };
and then initialized the child entity collection and added two children:
company.Car = new System.Data.Objects.DataClasses.EntityCollection<Car>();
company.Car.Add( new Car() { Name = "Mustang" } );
company.Car.Add( new Car() { Name = "Explorer" } );
I manually defined the schema with my first Band with a Key of, "Company", and the child band to a Key of, "Car".
The parent record is visible, but the child is not. How should I be doing this?
Thank you,
Blu
If you don't see the "+" sign beside each row, yu need to write:
grid.DisplayLayout.ViewStyle = ViewStyle.MultiBand
I think you also shouldn't always construct a new collection for Car. When you make a new Company you can start adding Cars without constructing its collection first. If you want to make sure there is nothing in the collection then use Clear(). This is very important when you bind the collection. If you construct a new collection you might lose the binding.
I commented out: company.Car = new System.Data.Objects.DataClasses.EntityCollection<Car>();
I changed the view style in Grid_InitializeLayout and it did not add the + symbol for the child rows.
private void Grid_InitializeLayout( ...
{
...
e.Layout.ViewStyle = ViewStyle.MultiBand;
}