In Silverlight for Windows Phone I have several view models that are disposable and perform necessary cleanup, like event unsubscribing from longer-living services, in Dispose().
When I navigate back in the view stack and the most recent view model have done its deed to completion, I need to call Dispose() on it.
What good patterns of doing this in a structured way are there?
You could make a Blend Behavior or attached property that listens for the Unloaded event, and then calls
Dispose()on theDataContextof the object if it’sIDisposable. This could then be attached to your Views as appropriate.