We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How can i get the mepping in WPF on a nested table?

Hallo,

I have a DataGridControl, which has a ObservableCollection<DataRowModel> as ItemSource.
The DataRowModel, have a nother ObservableCollection<Childrin>.

In WPF I create my own mapping for the columns and have AutoPopulateColumns= false, everything works finde... but how can I create a mapping for the childrin/nested table?
Is there any way in WPF? (cous i do MVVM, and dont want to to it in the codebehind)

Regards,

Sean Roddis

2 Replies

WP WPFGuru November 5, 2013 09:41 PM UTC

I think you can simplify the "waiting for good answers" job and I can recommend you a very good guide that can help you in your projects. It has great examples and for me it was very helpful: Beginning WPF 4.5 by full example. 

Good luck!


GA Gobinath A Syncfusion Team November 20, 2013 01:55 PM UTC

Hi Sean Roddis,

 

Sorry for the delay in getting back to you.

 

We have analyzed your query and you can create the Mapping name for nested grid by using the following code snippet.

 

Code snippet[XAML]:

  <syncfusion:GridDataControl.Relations >

                <syncfusion:GridDataRelation RelationalColumn="Collection" RelationType="MasterDetails" >

                    <syncfusion:GridDataRelation.TableProperties>

                        <syncfusion:GridDataTableProperties AutoPopulateColumns="False" >

                            <syncfusion:GridDataTableProperties.VisibleColumns>

                                <syncfusion:GridDataVisibleColumn MappingName="CustomerID" HeaderText="Id"/>

                                <syncfusion:GridDataVisibleColumn MappingName="CustomerName" HeaderText="Name"/>

                                <syncfusion:GridDataVisibleColumn MappingName="ProductID" HeaderText="ProductId"/>

                            </syncfusion:GridDataTableProperties.VisibleColumns>

                        </syncfusion:GridDataTableProperties>

                    </syncfusion:GridDataRelation.TableProperties>

                </syncfusion:GridDataRelation>

            </syncfusion:GridDataControl.Relations>

           

 

 

We have prepared simple sample base on your requirement and please find the sample under the following location.

 

Sample: NestedWithObservable.zip

 

Please let us know if you have any queries.

 

Regards,
Gobinath A.


Loader.
Live Chat Icon For mobile
Up arrow icon