In a Windows Phone 7 app, the PhoneApplicationService.Current.State object is declared as an IDictionary, and is implemented as a Dictionary. I was really hoping to get notified when any state changes occur. (I realise I could build my own state collection somewhere else and do whatever I want, but I’m retrofitting this into existing code.)
Is there any way to get that State object set to an ObservableDictionary instead of a Dictionary, so I can attach to it and get notified when the collection changes?
I’m guessing the answer will be ‘no’ but just want to check I haven’t missed something 🙂
Thanks,
John
You can’t change the existing implementation, but you could create a wrapper class which implements IObservable but uses
PhoneApplicationService.Current.Stateinternally.This way, you wouldn’t have to build a complete state persistence soution yourself and could implement the ObservableDictionary as best meets your needs.