I am used to work with XamGrid, and lately I decided to work more with XamDataGrid.
I have issues creating fields for properties inherited from other classes.
Example :
class Person { public string Name { get; set; } public int Id { get; set; } public School School { get; set; } public Person() { } } class School { public string Name { get; set; } public School() { } }
Now when I was using XamGrid, I could do it this way:
<ig:XamGrid.Columns> <ig:TextColumn Key="Name" HeaderText="Name" /> <ig:TextColumn Key="Id" HeaderText="Id" /> <ig:TextColumn Key="School.Name" HeaderText="School" /> </ig:XamGrid.Columns>
With XamDataGrid I have tried these:
<xDp:XamDataGrid x:Name="XdgrStudents" Grid.Column="0" AutoFit="True" BindToSampleData="False" Theme="Office2013" MaxHeight="250" > <xDp:XamDataGrid.ViewSettings> <xDp:GridViewSettings/> </xDp:XamDataGrid.ViewSettings> <xDp:XamDataGrid.FieldLayoutSettings> <xDp:FieldLayoutSettings AutoGenerateFields="False"/> </xDp:XamDataGrid.FieldLayoutSettings> <xDp:XamDataGrid.FieldLayouts> <xDp:FieldLayout> <xDp:FieldLayout.Fields > <xDp:Field Name="Name" Label="Name"/> <xDp:Field Name="Id" Label="Id"/> <xDp:Field Name="School.Name" Label="School"/> <xDp:Field Name="Serial" Label="Serial"> <xDp:Field.Settings> <xDp:FieldSettings AllowEdit="False"/> </xDp:Field.Settings> </xDp:Field> </xDp:FieldLayout.Fields> </xDp:FieldLayout> </xDp:XamDataGrid.FieldLayouts> </xDp:XamDataGrid>
It doesn't work, It binds correct because I can see that the rows are there, but it doesn't show any columns/fields.
What am I doing wrong ?
Hello Andrew.
Thanks for the answer.
No further questions on this matter.
Hello Nawed,
Just checking in, do you have any other questions or concerns on this matter?
Sincerely,AndrewDeveloper Support IInfragistics Inc.www.infragistics.com/support
As it turns out, I found a way to achieve the same functionality with a bit less code. If you use an UnboundField and set the Binding property to {Binding School.Name} it will yield the same result as writing the Style for the Editor.
Please let me know if you have any questions or concerns.
Hello Andrew,
It does the work, but in my opinion it's a wrong direction to go.
Why isn't it possible just to do like XamGrid ? Eg. School.Name
or add a displaymemberpath.
But yeah, it is how it is.
and I can accept it.
Thanks