Hi,
I have a class as below ::
public class Person { public string Name { get; set; } public int Age { get; set; } private ObservableCollection<object> _sample = new ObservableCollection<object>();
public ObservableCollection<object> sample { get { return _sample; } set { if (_sample == value) return; _sample = value; } } }
In the Main window constructor I have code as below::
List<object> data = new List<object>(); Person p = new Person(); Person child = new Person(); child.Age = 10; child.Name = "Child1"; p.Name = "Parent1"; p.Age = 30; p.sample.Add(child);
Person p1 = new Person(); Person child1 = new Person(); child1.Age = 10; child1.Name = "child2"; p1.Name = "Parent 2"; p1.Age = 30; p1.sample.Add(child1); data.Add(p1);
Person p2 = new Person(); Person child2 = new Person(); child2.Age = 10; child2.Name = "child3"; p2.Name = "parent 3"; p2.Age = 30; p2.sample.Add(child2); data.Add(p2);
this.DataContext = data; }
XAML for xam grid is ::
<igDP:XamDataGrid DataSource="{Binding}" Name="xamDataGrid1" VerticalAlignment="Top" > <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:Field Name="Age"/> <igDP:Field Name="Name"/> <igDP:Field Name="sample"/> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts> </igDP:XamDataGrid>
My Question is
1. I should not show the Headers for child elements in this case for the property Sample
2. Even if there are no children control is still showing (+) sign. If any child has no sub child then (+) should not be shown.
How can i achieve this, Thanks
Hi MAtt,
Parent Should show Header . I need to hide Headers for Only Child Elements.
<igDP:Field Name="Name" Label="Name" /> <igDP:Field Name="Description" Label="Description" Width="Auto" /> <igDP:Field Name="Components" Width="Auto" > -- This is My Child Collection which should not show Headers
Thanks Matt This solution was helpful.
HI ,
Here is a code snippet to hide the child header. igDP:FieldLayout> <igDP:FieldLayout.Settings> <igDP:FieldLayoutSettings LabelLocation="Hidden"/> </igDP:FieldLayout.Settings> <igDP:Field Name="Year"/> <igDP:Field Name="Model"/> <igDP:Field Name="Make"/> </igDP:FieldLayout>
I am attaching a sample that hides a child label.
Sincerely, Matt Developer Support Engineer