I am using navigation services in WPF. For navigating to page I use:
this.NavigationService.Navigate(new MyPage());
For going back I use:
this.NavigationService.GoBack();
But how do I go back to the first page (Home button) without using
this.NavigationService.Navigate(new FirstScreen());
Because I do not wish to create new first page, just go back to it? And I don't always open new screens in the same order.
&n writes the address of n . The address of a variable points to the value of that variable.
The Go To Line dialog box lets you move to a specific line in the active document. To access this dialog box, open a document for editing, and then select Edit > Go To > Go To Line or press Ctrl+G.
By default, Alt+Left navigates back, and if you remove the Alt+Right shortcut for Edit. CompleteWord in Microsoft Visual Studio, Alt+Right navigates forward.
One way could be to use method RemoveBackEntry until there is only a single entry left in the back stack of navigation service. Once there is only a single entry simple do Navigation.GoBack()
Here's a potential solution, however there may be a 'best practice' method that i'm not currently aware of:
while(this.NavigationService.CanGoBack)
{
this.NavigationService.GoBack();
}
CanGoBack returns true if there are entries in the back navigation history and as such GoBack() will be executed until it returns false. In theory this should get you back to the origin, or in other words the first page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With