Hi Team,
I am using XamDataGrid and the data source of the grid has a property that is a collection. By default when we bind this source, all the properties are displayed as grid columns and the child collection of each row is displayed with a expand button "+" in the left side, since by default the properties IsNestedDataDisplayEnabled="True" and AutoGenerateFields="True".
I have a requirement where I need to display only a few columns and each row with the child collection should still be displayed with the expand button "+" on the left side. I have set the properties to IsNestedDataDisplayEnabled="True" and AutoGenerateFields="False". By doing this the expand button "+" is shown but child grid is not displayed.
I have attached a sample with minimum data to demonstrate the same. Please let me know if there is a way we can achieve the above requirement but AutoGenerateFields="False" and not modifying the underlying entities.
Thanks,
Srikanth V.
I have a similar question. If I have a child collection within the main collection. I see it will expand as I need it to when I have AutoGenerateFields set to true. When I set it to false, it shows the expansion and blank fields. How do I manually create that sub-field where the rows will show? I know this original question is 4 years old. Maybe something has changed. I did look at the test project and did not have any success with it
Hello Srikanth,
I have taken a look at the sample project you have attached, and currently, the reason that you are not seeing your child fields is because there are no child fields defined in your XAML.
By setting the XamDataGrid.FieldLayoutSettings.AutoGenerateFields property to "False," this will mean that all fields in your XamDataGrid need to be manually generated, including the child ones. In the case of your XAML, you have a Field named Departments that points at a child collection on your data item, and this is required, but what is currently missing is a FieldLayout for that child collection.
I would recommend that you add a secondary FieldLayout to your XamDataGrid.FieldLayouts collection, and set that FieldLayout's ParentFieldName property to "Departments." This will designate that FieldLayout as a child layout to your Departments field, and will allow you to add fields related to your child data item. The FieldLayout in the case of your sample project could look like the following:
<igDP:FieldLayout ParentFieldName="Departments"> <igDP:Field Name="DepId"/> <igDP:Field Name="DepName"/></igDP:FieldLayout>
I have attached a modified version of the sample project you sent to demonstrate the above.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer