mercredi 27 avril 2016

How to databind two tables in GridView?

Basically, I need to join two ObservableCollections, like for example a Product and BrandInfo where the Product model has an unofficially defined foreign key to BrandInfo. These models are using Sqlite-Net for data persistence.

I want to display the combination of the two in a GridView, which will be the basis of future data manipulation on other Xaml screens.

My current setup has data bound through a viewModel class, acquiring data via the Product model. The viewModel has an ObservableCollection instance of Product, and properly works.

From what I read, I may need to use CompositeCollection or possibly create a model that represents the join of Product and BrandInfo. Considering Sqlite-Net doesn't support foreign keys like Entity Framework and other ORM's do, I'm not really sure how to go about using CompositeCollection. I'm also not sure if doing a not-database-stored combination of the two models is a good idea or not. Any advice or snippets can go a long way in helping me out!

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire