not sure if my title explains well the issue im having.
In my application i make a service calls to
-retrieve a list of customers.
-retrieve a list of organisations.
Then i bind this list of customers to a listbox on my view.
In my viewmodel i have the following properties:
IEnumerable<Organisation> Organisations
ObservableCollection<Customer> Customers
Organisation properties: OrganisationId, OrganisationName
Customer properties: CustomerId, OrganisationId, CustomerFirstName, CustomerLastName
Inside the Listbox on my view i want to show the organisationname for each customer in the list.
how can i go about binding this in my view? I just want a textblock to show the organisationname for the customer.
I’d flatten the Model in a customer ViewModel:
Then the owning ViewModel returns the collection of Customers:
Bind the ListBox to the OrgName property on the CustomerViewModel: