Is there a case where the OnNavigatedTo() function is not called when using NavigationService.GoBack()?

StackOverflow https://stackoverflow.com/questions/11529152

Frage

I'm working on a Windows Phone 7 Silverlight application. I was wondering if there is a case where the OnNavigatedTo() function is not called when using NavigationService.GoBack() ?

I'm working with two pages, one can add items to a database and the other can edit items in the database. The main page sends the user to each page with

    NavigationService.Navigate(new Uri(string.Format("/views/Add.xaml?parameter={0}", parameter), UriKind.Relative));
    NavigationService.Navigate(new Uri(string.Format("/views/Edit.xaml?parameter1={0}&parameter2={1}", param1, param2), UriKind.Relative));

Both options bring the user to a new page and both return the user via

    NavigationService.GoBack()

I have my OnNavigatedTo() function declared in MainPage, however only the Add page causes the function to execute while the Edit page seems to skip it on the return. The OnNavigatedTo() function repopulates an ObservableCollection to reflect the changes made by the user.

War es hilfreich?

Lösung

No, the OnNavigatedTo() will definitely be called. You can verify that using breakpoints while debugging. I think the problem might be the way you update your Collection. Some more code might help.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top