I have a XamDataGrid that has a parent/child (Project/Assessment) relationship. I've managed to indent the child rows via a DataPresenterStyleSelector, but it would be helpful if there was some sort of header above the child rows indicating what they were. Something like the blue rows, which appear above the column headers.
Hello Danielle,Thank you for the screenshots you have provided.I have been looking into your issue and the header (ExpandableFieldRecordHeader) you have mentioned does exist when the child collections for every record from the initial FieldLayout are two or more. This behavior for the XamDataGrid is by design.If you would like to keep the ExpandableFieldRecordHeader visible, even when you are using a single collection, an easy way of achieving this would be to create a new and empty, dummy collection. This way the XamDataGrid will recognize the multiple collections' existence and will automatically enable the ExpandableFieldRecords. 1) Afterwards by setting the ExpandableFieldRecordExpansionMode property to ExpandAlways and the ExpandableFieldRecordHeaderDisplayMode property to AlwaysDisplayHeader for the collection's Field that should be visualized, you should be able to achieve the desired functionality.// Visualized collection<igDP:Field Name="Bills"> <igDP:Field.Settings> <igDP:FieldSettings ExpandableFieldRecordExpansionMode="ExpandAlways" ExpandableFieldRecordHeaderDisplayMode="AlwaysDisplayHeader" /> </igDP:Field.Settings></igDP:Field>2) Please note that in order to disable the visualization of the dummy collection as a child FieldLayout, you can do this by setting the Visibility of the corresponding collection's Field to Collapsed:// Dummy collection<igDP:FieldLayout Key="parentLayout"> <igDP:Field Name="Items" Visibility="Collapsed" /></igDP:FieldLayout>I have prepared a sample application where this behavior has been introduced. Would you please take a look at it and if you are still experiencing any issues or this is not the behavior you were aiming for, please let me know.
Tacho,
Thanks, this is a good starting point for the functionality I need to achieve. Is there a way to make the background a solid color, rather than the blue gradient default? The background property doesn't seem to do it. Additionally, having the count of the records like Bills (2) would be a nice-to-have.
Hello Danielle,
I have been looking into the behavior you have described in your last post and I have modified the "App.xaml" and "App.xaml.cs" files from the sample I have previously attached. I have added a Style for the ExpandableFieldRecordPresenter and this way reflecting all changes for the entire sample application.
1) In order to set the Background of the headers, you should be able to do so by creating a Style and an EventSetter for the Loaded event of every ExpandableFieldRecordPresenter. Inside the event, you can get the Border that is responsible for the background color for every ExpandableFieldRecordPresenter and set it's Background property respectively.
Refer to "SetHeadersBackground" commented line in App.xaml and the event handler in App.xaml.cs.
2) In order to add a number to the headers, which indicates the number of child records that are contained within the current collection, you can do that by getting and modifying the default style for the ExpandableFieldRecordPresenter.
Inside the Grid responsible for the RecordContentSite, you can add an additional TextBlock in the respective ContentPresenter. The Text property of the new TextBlock will be bound to the Count property of the ChildRecords collection for the current ExpandableFieldRecord.Refer to "NewContentPresenter" commented line in App.xaml.
If you require any further assistance on this matter, please do not hesitate to ask.