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
1280
XamDataGrid Fields
posted

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 ?