I’m using WPF. On my window there is a data grid which binding with observable collection. This collection contains data about room check outs. So there is also one window which must add service collection to data grid >> create new collection with name of service an fill cell with price.
This price must be set on row where id(column) == "example". I think it must be very easy but I’m trying this 2 days.. so my question : is it possible to bind data grid with two collections?
How I can add collection new property ? Like that : public string ServiceName{get;set;} from another window.
Please advice some good thing how to solve this problem
To bind to multiple collections use the CompositeCollection.
Here’s a ListBox example:
This example and more info can be found on MSDN: http://msdn.microsoft.com/en-us/library/system.windows.data.compositecollection.aspx.
Another important point to mention is CompositeCollection does not implement IEditableCollectionView so if you need to edit the datagrid, you cannot use CompositeCollection without implementing IEditableCollectionView yourself.