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

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

문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top