Frage

In my application, I have list of news... When user click on some item, I navigate him to page with detail:

NavigationService.Navigate(new Uri("/Detail.xaml?ID=" + listbox.SelectedIndex, UriKind.Relative));

On this detail page are also button prev and next, which navigate to next and previous items (also to Detail.xaml, just ID is increased or decreased by 1). However, if user go through some news and want to return to "homepage", he needs to push Back button many times. Is there any way, how can I just close this Detail.xaml? Open it modal or something? I don't want to use "go home" button, which just navigate user to main page because of loop when he tries to exit application...

War es hilfreich?

Lösung

When the next or previous buttons are clicked try calling NavigationService.RemoveBackEntry() in the OnNavigatedTo method. This will remove the page from the back stack, thus ensuring that when they hit the back button they return to the index page.

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