I have a hierarchical data grid bound to a dataset that defines a relationship between Customers and Orders (1 to many). The grid displays customer rows, and each customer row can be expanded to show orders. In this scenario, how can I customize the "nested" grid that appears when a customer row is expanded to show order info? This is a simple prototype, so the only customizations I'm looking for are showing/hiding columns, column width, & edit/readonly.
Thanks in advance!
This is a fascinating thread. If you took this and whipped up a sample application or turorial showing several incremental versions demonstrating these techniques, I think it would be well received. I pritned this out and will be studying it, because I think it holds some keys to my struggles...
No, there is no parent/child relationship between the the FieldLayouts for the reasons I mentioned, they aren't tied to the structure of the data to enable the support of more free form data structures.
One thing you could do is wire up the AssigningFieldLayoutToItem. Then you could create a class to use as the Key of the FieldLayout with an initialization flag so you only do the initialization once and possibly other state imformation, e.g. something like the following:
{
key = new MyFLKey (); e.FieldLayout.Key = key;
key = new MyFLKey ();
e.FieldLayout.Key = key;
}
key.IsInitialized = true; DataRowView drv = e.Item as DataRowView; // do your initialization on the FieldLayout
DataRowView drv = e.Item as DataRowView;
// do your initialization on the FieldLayout
The my problem, Im not predefining the FieldLayouts because its user defined on the screen. They can custmize the view to have as manay columns in the main view as well as the nested view.
Im using a DataSet with 2 DataTables with a DataRelation between them for this. All of this is created on the fly when the user selects a few settings on the screen.
Do the FieldLayouts have a parent child type relationshipe between the main one and the nested ones ?
Any other ways ?
Thanks
DK
If you are predefining the FieldLayouts in code or xaml you can specify a Key property to uniquely identify each one.
Note: The FieldLayouts are not assuming a fixed data structure and therefore there is nothing to prevent the same FieldLayout from being used for records at different levels. This allows us to support more complex data structures like trees and also to support heterogenous data (sibling records with different layouts).
Hey Joe,
Question on FieldLayoutInitialized event..
The FieldLayout that is passed into this method, how do I know the differencence between the Main FieldLayout compared to a nested Fieldlayout ?
I need to do some custimization to the main set of columns and headers, but also need to do different stift to the list of nested columns.
I cant find an easy way of determining which fieldlayout belongs to which set of views persay.