Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2325
Xam Data Grid - Display Hierarchial Data
posted

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

Parents
  • 17475
    Verified Answer
    Offline posted

    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.

    XamDataGridParentElProperties.zip
Reply Children