I have a complex User Control that contains some views, each have its own ViewModel. My question is how can all of these ViewModels share some data (for example an observable collection) without each one have a separate call to the service?
0
votes
1 Answers
0
votes
The service should be an abstraction of the data. Whether that data is pulled from a WS, DB, etc...should be irrelevant. Each ViewModel can contain a property which will be bound to by the View. That property can be an ObservableCollection<T>
which wraps a call to the service. That data may in fact be cached via the service and only update periodically but either way it will push the data to a single point of reference for retrieval amongst the ViewModels.