Cloud Training (Online)




GoForward in Your Windows Phone Application

The Developers can use the NavigationServices to navigate from one form to another in Windows Phone .

This class also provides functions GoBack that simulates the Hardware backbutton .

Here’s a simple example that demonstrates the GoBack .

 

 
private void btnNavigate_Click(object sender, RoutedEventArgs e)
{
     NavigationService.Navigate(new Uri("/Page1.xaml", UriKind.RelativeOrAbsolute));
}

private void btnForward_Click(object sender, RoutedEventArgs e)
{
     NavigationService.GoForward();
}

private void button1_Click(object sender, RoutedEventArgs e)
{
     NavigationService.GoBack();
}

When you click on the back button , this will simulate the hardware back button .

When you click on the Button forward , you will get an exception “Cannot go forward when CanGoForward is false.”

This is because , currently the WP7 does not support forward navigation and when used , the field CanGoForward is also false and hence we get this exception .

Wondering why is this is included when it is not supported 🙁

 

Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.