views:

39

answers:

0

Hi All, I have three tables in my db, One Parent (Product) and two childs(ProductStyles, ProductSizes) which means that a Product can have multiple Styles and Sizes. Now What I want to do is:-

1) Shows the Products in dataGrid with having the columns Styles and Sizes and these columns should only display the Total Counts (ie how many styles and sizes the product have.e.g 5, 6).

2) In the RowDetailTemplate, I want to have three elements, two datagrids (one for Styles and Sizes each) displaying the records from ProductStyles and ProductSizes tables and a ContentControl with DataTemplate as well showing the Product Image and some other info based upon the DataTemplate assigned to it.

3) Upon Edit options, The Child Window should display the Product Info, its Styles and Sizes as well where the User can either amend/Add new Styles/Sizes and main product info as well.

Any suggestions the best approach to acheive this with sample code if possible?

I believe to have a another Class/ViewModel for this Page which would have a) All Products/ProductStyles/ProductSizes in ObservationCollections b) Create a PagedCollectionView manually to have the Product Columns with Styles/Sizes Columns "Counts" and assigning it to datagrid ItemSource. c) On datagrid selectionChanged event, creating the new collections for Styles/Sizes for that particular Product, assigning them to child datagrids of RowDetailsTemplate d) Assign the same ViewModel to ChildWindow where the user can amend the different details of Product/Styles/Sizes and save them in their respective ObservationCollections and to the DataContext object as well.

Any response would be much appreciated?

Regards Jhelumi