Hello,
I'd like to display a "nested panel" when a User clicks on a Row in the xamDataGrid.
This is the code I tried to use:
<igDp:XamDataGrid.FieldLayouts> <igDp:FieldLayout Key="MyParent" > <igDp:FieldLayout.FieldSettings> <igDp:FieldSettings ExpandableFieldRecordHeaderDisplayMode="AlwaysDisplayHeader"/> </igDp:FieldLayout.FieldSettings> <igDp:FieldLayout.Fields> <igDp:Field Name="CountryCode" Label="CountryCode" /> <igDp:Field Name="CountryName" Label="CountryName" /> <igDp:Field Name="Detail1" Label="Detail1" /> <igDp:Field Name="Detail2" Label="Detail2" /> <igDp:Field Name="Detail3" Label="Detail3" /> <igDp:Field Name="MyDetails" Label="MyDetails" Visibility="Hidden" /> </igDp:FieldLayout.Fields> </igDp:FieldLayout> <igDp:FieldLayout Key="MyDetails" ParentFieldLayoutKey="MyParent" KeyMatchingEnforced="True"> <igDp:FieldLayout.Settings> <igDp:FieldLayoutSettings /> </igDp:FieldLayout.Settings> <igDp:FieldLayout.Fields> <igDp:Field Name="DetailCode" Label="DetailCode" /> <igDp:Field Name="DetailText" Label="DetailText" /> </igDp:FieldLayout.Fields> </igDp:FieldLayout> </igDp:XamDataGrid.FieldLayouts>
And this is how my class looks like:
public class CountryRowViewModel { public int CountryCode { get; set; } public string CountryName { get; set; } public string MyHiddenProperty { get; set; } /* I don't want to display this*/ public string Detail1 { get; set; } public string Detail2 { get; set; } public string Detail3 { get; set; } public DetailsViewModel MyDetails { get; set; } public class DetailsViewModel { public int DetailCode { get; set; } public string DetailText { get; set; } } }
I want to display the nested "field layout" without using AutoGenerateColumns=true, since there will be some custom additions. Any idea how to do that?
Also how would I have to change the code to display e.g. a StackPanel or a TabControl (for Charts) instead of a nested grid?
Thanks a lot!
Regards,
Andreas
Thanks, making the DetailsViewModel a collection did the trick.
What I want is something like this
[Grid]
+ Row Entry 1
+ Row Entry 2
+ Row Entry 3
++ Nested Row Entry 1 (which belongs to Row Entry 3)
+++ Nested StackPanel with Buttons (which belongs to "Nested Row Entry 1" and has it's DataContext)
Do you have an example for doing that in XAML?
Hello Andreas,
You have defined the FieldLayouts and their Fields, but as you are using AutoGenerateFields-True, you do not need to do that. Also, I notice that you have two field layouts, but your class does not have a collection to display in a nested fieldlayout. DetailsViewModel class is no a IEnumerable, so you would have to use UnboundFields to show DetailCode and DetailText. The XamDataGrid will not be able automatically to do that for you. If you want a hierarchical XamDataGrid, you have to make the DetailsViewModel a collection.
Also, I was not able to understand how you want to show a "nested panel" and where. The ExpandableFieldRecordPresenter is probably what you want to retemplate or style. You would probably also need to set UseNestedPanels from the ViewSettings to true.