hello,
i am follow the simple example included in my Infragistics WPF SDK (v11.1) in having a subgrid.
This works, however, it creates a subgrid for every collection on my main object, and a column for every field on the SubObject.
1. I would like the subgrid to show only for a collection property called Adjustments (which is a BindingList<MyType>).
2. I would like to be able to show subgrid columns selectively
3. I would like to be able to expand/collapse all subgrids "expand all / collapse all"
My grid definition:
<!-- Grid --> <igDP:XamDataGrid Grid.Row="1" x:Name="TransactionsGrid" DataSource="{Binding Transactions}" RecordContainerGenerationMode="Virtualize" SelectedItemsChanged="TransactionsGrid_SelectedItemsChanged" c:MouseDoubleClickBehavior.MouseDoubleClickCommand="{StaticResource TopsideEditCommand}" FontSize="11"> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowEdit="False" /> </igDP:XamDataGrid.FieldSettings> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="True" AllowAddNew="False" AllowDelete="True" SelectionTypeRecord="Single" HighlightAlternateRecords="True" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="UID" Label="" Width="20" /> <igDP:Field Name="EntityName" Label="Entity" Width="200" /> <igDP:Field Name="ReasonName" Label="Reason" /> <igDP:Field Name="PocketName" Label="Side Pocket" Width="200" /> <igDP:Field Name="Notes" Width="300" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout> <!-- Subgrid --> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="FinancialAccount" Visibility="Collapsed" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
i would also like to set AutoGenerateFields to false, if possible.
thanks.
Hello Squarewave,
Thank you for your response. I am glad that you resolved your issue.
this is great, thanks!
exactly what i was looking for. much appreciated!
Hello squarewave,
Thank you for your post. After some research on this issue I made a sample project demonstrating the behavior you had described. I used a BindingList collection to set the Adjustments property to the source data which is of type MyType (defined in the code).
I added two buttons to the window - one allowing the user to expand all subFields (ExpandAll) and allowing the user to collapse all subFields(CollapseAll). I handle the click events of the buttons and use ExpandAll and CollapseAll methods of the XamDataGrid’s records to achieve this functonality.
for #1 specifically, it is showing a subgrid heading for a List<string> property on my object.
I need it to be a public property because i am binding a different control to this.
I would like the ability to omit this property from being shown as a sub-grid.