I have inherited some Silverlight\WCF code and now need to implement some new features. I fairly new to Silverlight\WCF so my question may be rather basic. So...
I have a listbox in Silverlight that binds to a resource that is a List<> returned from a WCF (rest) service (which is just reading values from a db table). I have implemented the ability to add new items to the db table through a WCF service and now want to make my listbox update once it has been added to the db.
It is possible that my initial code needs to change so I have listed the relevant lines below.
In xaml the resource is as such:
<CollectionViewSource x:Key="myWCFSvc">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription Direction="Ascending" PropertyName="ID" />
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
And the binding of the listbox is:
ItemsSource="{Binding Source={StaticResource myWCFSvc}}
And the .cs has in the callback
((CollectionViewSource)LayoutRoot.Resources["WCFSvc"]).Source = myList;
So now if a user adds a new entry through another Silverlight childwindow an new entry is created in the db and I want to update the listbox to include this entry. I'm unclear how to do this.
I know there are observablecollections and INotifyPropertyChanged but unsure if this is those are what I need, or how to use them in this context. I searched around a bit but the examples I found don't seem fit my scenario.