I'm writing a small test app to try and figure this out and so far I have this :
<igDP:XamDataGrid x:Name="xamDataGrid" DataSource="{Binding}" Theme="Office2k7Blue" > <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" ExpansionIndicatorDisplayMode="CheckOnDisplay" HighlightAlternateRecords="True"> </igDP:FieldLayoutSettings> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout Key="master"> <igDP:FieldLayout.Fields> <igDP:Field Name="SubLocations" IsExpandable="True"/> <igDP:Field Name="ID" Visibility="Collapsed" /> <igDP:Field Name="Name" /> <igDP:Field Name="Description"> </igDP:Field> </igDP:FieldLayout.Fields> </igDP:FieldLayout> <igDP:FieldLayout Key="detail"> <igDP:FieldLayout.Fields> <igDP:Field Name="ID" /> <igDP:Field Name="Name" /> <igDP:Field Name="Description" Width="20" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
Which is bound to some data using this class hierarchy :
public class LocationParent : Location { public int NumChildren { get { return SubLocations != null? SubLocations.Length : 0; }} public Location[] SubLocations { get; set; } } public class Location { public int ID { get; set; } public string Name { get; set; } public string Description { get; set; } }
Everywhere I've read so far suggests that adding IsExpandable="True" to a field will indicate to the data grid that that field's children should have a field layout applied to them, but this doesn't happen and all I end up with is "Location[] Array" displayed when I expand the item.
This may be a misunderstanding on my part, but what I also don't understand is why, when I have AutogenerateFields="False", the records are not expandable at all.
I'd like to be able to show child records which have a field layout showing only some of their actual properties, but unless AutoGenerateFields is set to true, I can't seem to ever show them, and when that's the case, the datagrid auto generates all the fields I don't want to see!
Hello,
I have been looking into you issue and can suggest reading through these links from our online documentation which should clarify things for you:
http://help.infragistics.com/Help/NetAdvantage/WPF/2010.3/CLR4.0/html/xamData_Displaying_Hierarchical_Data.html
http://help.infragistics.com/Help/NetAdvantage/WPF/2010.3/CLR4.0/html/xamDataPresenter_Define_a_Field_Layout.html
http://help.infragistics.com/Help/NetAdvantage/WPF/2010.3/CLR4.0/html/xamDataPresenter_Manually_Assigning_a_Field_Layout_to_xamDataPresenter.html
After displaying your hierarchical data you can use this property: ExpansionIndicatorDisplayMode="CheckOnDisplay" from the FieldLayoutSettings in order to display the ExpansionIndicator only for Records which have underlying data.
Please let me know if you require any further clarification on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
I'm having this problem, too, and the answer is not really the solution for it.
The question in short:
if I have a DataGrid with AutoGenerateFields set to "false", where do I set the FieldLayout for the Sub-Grids, if I have defined columns in my master grid with "IsExpandable" as "true"?
I found the answer myself:
Define another FieldLayout with "ParentFieldName" set to the correspondending expandable field.