Hello,
I have a Customer with Orders and those have products. Everything aggregated with collections of type ObservableCollection.
All 3 collections are bound to a datagrid/combobox.
I can only make the root collection (ObservableCollection Customers{ get;set;} )
passing to a CollectionView so I can move the current customer within the combobox.
But how can I move around the current Order in the datagrid? How to pass the selected Orders to another CollectionView ?
Does all this maybe not work?
Sample provided: not written in a c# editor just manually here so there could be errors...
public class Customer { public int id {get;set;} public string FirstName { get;set;} public List Orders {get;set;} }
public class Order { public int id {get;set;} public int OrderNumer {get;set;} public Date OrderDate {get;set;} public List Products {get;set;} }
public class Product { public int id {get;set;} public int Quantity {get;set;} public float Price {get;set} }
Now I get all customer, order and product data from database:
BillingViewModel.cs private List _customers;
//Ctor public BillingViewModel() {
Customers = new ObservableCollection(repositoryCustomer.FetchAllEntities());
// Assign here the Customers, Orders,Products to 3 different CollectionViews... // so I can bind my 3 gui controls to those 3 views and can use the move operations for the current item! }
public ObservableCollection Customers {
get´{return _customers;} set { //... _customers = value; }
}