I have a question about the Silverlight WCF Binding Pattern:
There are many examples of how to bind data using {Binding} expressions in XAML, how to make asynchronous calls to the WCF service, set the DataContext property of an element in the user interface, how to use ObservableCollections and INotifyPropertyChanged, INotifyCollectionChanged, and so on.
Background: I am using the MVVM pattern and have a Silverlight ItemsControl whose ItemsSource is set to the ObservableCollection property on my ViewModel. My view, of course, is XAML, which has {Binding}. Let's say the model object is called "Metric". My ViewModel periodically calls WCF service calls, which returns an ObservableCollection. MetricInfo - data transfer object (DTO).
My question is double:
- Is there a way to avoid copying each property of MetricInfo into the model class - Metric?
- When WCF calls end, is there a way to make sure that I synchronize the elements that are in my local ObservableCollection and the result of the WCF call - without having to clear all the elements in the local collection first and then add everything from the result of the WCF call?
thank you Krishna