Hi all,
I'm struggeling for quite some time now with binding my ListView to a table. I've read various solutions, but I keep running into trouble.
I have 2 database tables: Customers and Products. For each Customer there is a list of Products.
In my first attempt I bind to the generated Linq-to-SQL code. That means I binding immediately to Customer.Products. But since this is of type System.Data.Linq.EntitySet, I don't get notified when items are added to/removed from the database.
So I extended the generated code by adding a method to Customer that wraps the returned System.Data.Linq.EntitySet in an ObservableCollection (as adviced by various blogs)
public ObservableCollection<Product> ObservableProducts
{
get
{
return new ObservableCollection<Product>(Products);
}
}
But now I cannot add anything to the collection. When I call ObservableProducts.Add() nothing is added..