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!
You rock Joe, very helpful! Now I can chose between your code or XAML approach.
Cheers!
You can add multiple FieldLayouts in xaml to the FieldLayouts collection and define the fields for each one in their Fields collections.
As we load each record we loop over the FieldLayouts collection looking for an appropriate FieldLayout that contains a set of Fields whose Names match the properties of the record.
BTW, we also raise the AssigningFieldLayoutToItem event to allow you to override the default FieldLayout assignment in code.
I hope this helps.
The syntax is:
e.FieldLayout.Fields[x].Settings.AllowEdit = True
Thanks Joe. Is there any way to configure the settings of the nested grid in the XAML?
Also, i'm having a bit of trouble setting these properties in code when I handle the FieldLayoutInitialized event. I'm trying to use:
e.FieldLayout.Field but the properties (ex AllowEditResolved) are read only. If I set the properties in e.FieldLayout.FieldSettings.AllowEdit, it applies to all my fields. How can I set these properties programatically for each column individually?
Wire up the FieldLayoutInitialized event. The FieldLayout is passed in and you can modify the Field settings there.