Wp7 Deactivation with Back

Topics: Feature Requests, Framework Services
Apr 6, 2012 at 3:00 PM


in the deactivation of Screen, there is the property closed that is always setted as false.
So, I think, I don't know when I have to release resources. I don't want to do when I'm navigate to a new page, but I want to do it when I'm leaving the page with the Back button.

In the ViewAware I added an event called OnNavigatingBack and in the implementation of FrameAdapter, in OnNavigating method, at the bottom (after the deactivation) I raise that event:

if (e.NavigationMode == NavigationMode.Back)
                var viewAware = fe.DataContext as ViewAware;
                if (viewAware != null && frame.CurrentSource != e.Uri)

I don't know if it's a good idea, but I think that the ViewAware should give the notification of when the navigation is going back

Apr 6, 2012 at 4:04 PM

Check out the source for the WP7 WindwoManager.

You can also do something like:  

PhoneApplicationPage = NavigationService.CurrentContent as PhoneApplicationPage;
            PhoneApplicationPage.BackKeyPress += PhoneApplicationPageBackKeyPress;