I have a xamDataGrid that is bound to an ObservableCollection of Foo1 objects. Each Foo1 object has an ObservableCollection of Foo2 objects.
I would like to add a second grid to display the Foo2 objects for the ActiveRecord of the Foo1 grid. The problem I'm having is that I can't seem to convert the ActiveRecord object to a Foo1, and therefor cannot access the collection of Foo2 objects.
I'm also going to want to bind a few other controls (textboxes, combobox etc) to the ActiveRecord of the Foo2 grid.
How do I do that?
What Fintan suggested is correct. Of course, you could bind the DataContext of the second XamDataGrid to ActiveRecord.DataItem and then bind the DataSource of the second grid to the collection property.
You can set the ActiveRecord to the first record, for example in the Loaded event of the XamDataGrid, something like this:
xamDataGrid1.ActiveRecord = xamDataGrid1.Records[0];
Hope this helps.
The binding statement for the active record should be something along the lines of:
"{ Binding ElementName =mainDataGrid, Path =ActiveRecord.DataItem}"
I also need the first row in the grid to be the ActiveRow by default.