I am trying to write a fairly simple user control in Silverlight 2 that allows the user to search for existing addresses, optionally update the selected address, and add new addresses.
To this end I have put together a simple WCF service that allows for simple querying and I am currently wiring this up to a textbox, listbox combination (soon to replaced with the AutoCompleteBox from the Silverlight Toolkit).
My issue is more one of understanding, the return type from my service is of type IList<Address> and Address does not implement INotifyPropertyChanged and it doesn't seem appropriate for objects returned from the service (which may also be called by other clients) to have SL2 specific functionality baked in. What is the best approach to use to facilitate two-way binding to edit existing addresses.
Basic idea follows thus:
- User enters information into textbox
- Service called to retrieve matching addresses IList<Address> which is being returned as ObservableCollection<Address> in the Reference.cs for my service
- Returned values are set as the listbox's ItemSource
- User selects correct address and indicates an update is required
- Address instance bound to control container containing multiple textboxes
Essentially I want any changes in the bound textboxes to be reflected automatically in the Address instance, but without INotifyPropertyChanged how will this work? Do I have to create another class in my SL2 application that effectively overrides the property implementations for my service data object?
Can anyone out there point me in the right direction on this one as it's just not making sense to me...
Cheers,
Steve