Hi,
I have a class as below.
public class Element
{
public guid ElementID{get;set;}
public string Elementnumber{get;set;}
public string Description{get;set;}
public int Sequence{get;set;}
public observablecollection<Element> ChildElements
}
My XAML looks like
<igDP:XamDataGrid DataSource="{Binding DeviceElements}" x:Name="list">
<igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AllowAddNew="False" AllowDelete="False" AutoGenerateFields="False" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldSettings> <igDP:FieldSettings AllowEdit="False" CellClickAction="SelectRecord" AllowGroupBy="False" AllowHiding="Never" AllowRecordFiltering="False" AllowSummaries="False" /> </igDP:XamDataGrid.FieldSettings> <igDP:XamDataGrid.ViewSettings> <igDP:GridViewSettings /> </igDP:XamDataGrid.ViewSettings>
<igDP:XamDataGrid.FieldLayouts>
<igDP:FieldLayout IsDefault="True">
// Parent Fields <igDP:Field Name="ElementNumber" Label="Element Number" Width="Auto" /> <igDP:Field Name="Description" Label="Description" Width="Auto" />
// This is an enumarator Field. <igDP:Field Name="ChildElements" Label="Child Elements" Width="*" />
</igDP:FieldLayout> <igDP:FieldLayout Key="ChildElements"> <igDP:Field Name="Sequence" Label="Sequence Number" Width="Auto" /> <igDP:Field Name="ElementNumber" Label="Element Number" Width="Auto" /> <igDP:Field Name="ElementID" Label="Parent Element ID" Width="Auto" /> <igDP:Field Name="Description" Label="Description" Width="Auto" /></igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
My Question is Parent Element should show only 2 properties while my child element should show all properties.
How can i achieve this . Thanks for Help
Hello Jerovsek,
I have been looking through your post and what I can suggest you here is using different classes for the parent and for the child elements. I made simple project representing this behavior and attached it to this post. Please have a look at it and let me know if it resolves your issue.
This Solution Worked out after creating different classes for Parent & child .
Also in XAML i had to add "Key" property and refer it to my child class as below
<igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:Field Name="ElementNumber" Label="Element Number" /> <igDP:Field Name="Description" Label="Description" Width="Auto" /> <igDP:Field Name="ChildElements" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout> <igDP:FieldLayout Key="ChildType"> <igDP:FieldLayout.Fields> <igDP:Field Name="ElementNumber" Label="Element Number" Width="Auto" /> <igDP:Field Name="Description" Label="Description" Width="Auto" /> <igDP:Field Name="MetaFields" Label="Meta Fields" Width="Auto" /> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts>
Thanks.
Thank you for your response. I am glad that you resolved your issue and I believe that other community members may benefit from this.