×
Namespaces

Variants
Actions
(Difference between revisions)

Solving Circular Navigation in Silverlight for Window Phone

From Nokia Developer Wiki
Jump to: navigation, search
Jeffrey.Halimsetiawan (Talk | contribs)
(Jeffrey.Halimsetiawan -)
 
hamishwillee (Talk | contribs)
m (Hamishwillee -)
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:Windows Phone]][[Category:Silverlight]][[Category:Tutorial]]
+
[[Category:UI on Windows Phone]][[Category:Windows Phone 7.5]][[Category:XAML]][[Category:Code Examples]][[Category:Tutorial]]
{{Abstract|This article explains how to resolve circular navigation problem that may occurs in the navigation between pages in Silverlight for Windows Phone. }}  
+
{{Abstract|This article explains the Windows Silverlight app "circular navigation problem", and introduces the [http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx NonLinear Navigation Services] library which can be used to overcome it. }}  
  
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
Line 10: Line 10:
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
|dependencies= NonLinear Navigation Services
 
|dependencies= NonLinear Navigation Services
|signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
+
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 
|keywords= Circular Navigation, Silverlight for Windows Phone, NonLinear Navigation Services
 
|keywords= Circular Navigation, Silverlight for Windows Phone, NonLinear Navigation Services
Line 16: Line 16:
 
|translated-by= [[User:Jeffrey.Halimsetiawan]]
 
|translated-by= [[User:Jeffrey.Halimsetiawan]]
 
|translated-from-title= Mengatasi Circular Navigation pada Silverlight for Window Phone
 
|translated-from-title= Mengatasi Circular Navigation pada Silverlight for Window Phone
|translated-from-id= <!-- Id of translated revision -->
+
|translated-from-id= 173934
|review-by=<!-- After re-review: [[User:username]] -->
+
|review-by= <!-- After re-review: [[User:username]] -->
 
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 
|update-by= <!-- After significant update: [[User:username]]-->
 
|update-by= <!-- After significant update: [[User:username]]-->
 
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 
|update-timestamp= <!-- After significant update: YYYYMMDD -->
|creationdate= <!-- Format YYYYMMDD -->
+
|creationdate= 20120928
 
|author= [[User:Jeffrey.Halimsetiawan]]
 
|author= [[User:Jeffrey.Halimsetiawan]]
 
}}
 
}}
  
 
== Introduction ==
 
== Introduction ==
In the Silverlight for Windows Phone application model which is using several pages as its element, almost all applications consist of the various pages and the user has the right to navigate back. For each application, Windows Phone also keeps back-stack of pages which is a history of the pages that have been visited by the user. With such mechanism, developers are often faced with a situation where the application has a loop on page navigation.
+
In the "standard" Windows Phone Silverlight application model, users move linearly "forward" through pages and can then use the "back" button to retract through previously visited pages, and finally to exit. Windows Phone navigation history maintains a "last-in, first-out" structure called "back-stack". This provision makes it easy to implement a linear path forward and back through navigated pages.  
  
Loop on the back-stack from the application navigation means there is duplication of the same page in the application back-stack. For example, the illustration can be seen in game [http://www.windowsphone.com/id-id/store/app/petualangan-aksara-di-tanah-jawa/a7b95aaa-221d-4684-ac5e-06a1cd016523 Petualangan Aksara di Tanah Jawa] below:<br/>[[File:CircularNavigationIllustrat.jpg]]
+
However it is possible to directly navigate to an arbitrary URI from any page, and this can result in navigation to a URI that is already in the back-stack, creating a loop. This can result in confusing navigation for the end user. Consider for example, if the user can navigates to "Home" rather than unwinding the page stack as shown in the game [http://www.windowsphone.com/id-id/store/app/petualangan-aksara-di-tanah-jawa/a7b95aaa-221d-4684-ac5e-06a1cd016523 Petualangan Aksara di Tanah Jawa] below:
 +
[[File:CircularNavigationIllustrat.jpg|none]]
  
Another example, when you create registration wizard, it requires a lot of inputs so it consists of several pages. If we use {{Icode|NavigationServices.Navigate()}} method to return to the {{Icode|MainPage}} then we will return to the {{Icode|GamePage}} when we press the ''''Back'''' button. In fact, the expected response is out of the application.
+
Users expect to exit the game when they press the '''back''' button from the home page, but because of the loop they will be taken back to a previously navigated "stage" page.
  
The solution to overcome this problem is to use a '''NonLinear Navigation Services''' library developed by [http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/windows-phone-recipes-helping-the-community.aspx Windows Phone Recipes].
+
One solution to overcome this problem is to use a [http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx NonLinear Navigation Services]<ref>Kiriaty, Yochay. 2010. [http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx Solving Circular Navigation in Windows Phone Silverlight Applications].</ref> library developed by [http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/windows-phone-recipes-helping-the-community.aspx Windows Phone Recipes]. This library automatically unwinds any loops if it detects that you're navigating to a page that is already in the back stack.
  
== Procedure ==
+
== Using the library ==
The steps which must be done are quite easy, as follow:
+
The steps for using this library are straightforward:
 
+
# Download [[File:NonLinear-WP-SLApp-Navigation-Service.zip]]
# Download [http://www.developer.nokia.com/Community/Wiki/File:NonLinear-WP-SLApp-Navigation-Service.zip NonLinear Navigation Services]
+
 
# Add '''NonLinearNavigationServices''' project in the '''Solution''' which has been created.
 
# Add '''NonLinearNavigationServices''' project in the '''Solution''' which has been created.
# Initialize the service at the end of class constructor whose class is the inheritance of {{Icode|Application}} class.<code csharp>NonLinearNavigationService.Instance.Initialize (RootFrame);</code>
+
# Initialize the service at the end of class constructor whose class is the inheritance of {{Icode|Application}} class.<code csharp>NonLinearNavigationService.Instance.Initialize(RootFrame);</code>
  
 
== Summary ==
 
== Summary ==
With NonLinear Navigation Services, developer will be easier to develop applications because they do not need to waste a lot of time thinking about the navigation management of the application.
+
With ''NonLinear Navigation Services'', developers can more easily develop applications because they do not need to waste a lot of time thinking about the navigation management of the application.
  
 
Good luck!
 
Good luck!
  
 
== Reference ==
 
== Reference ==
Kiriaty, Yochay. 2010. [http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx Solving Circular Navigation in Windows Phone Silverlight Applications].
+
<references/>
 +
<!-- Translation --> [[id:Mengatasi Circular Navigation pada Silverlight for Window Phone]]
 +
<!-- Translation --> [[zh-hans:在Silverlight中为Window Phone解决循环导航]]

Latest revision as of 14:10, 2 July 2013

This article explains the Windows Silverlight app "circular navigation problem", and introduces the NonLinear Navigation Services library which can be used to overcome it.

WP Metro Icon UI.png
SignpostIcon XAML 40.png
SignpostIcon WP7 70px.png
Article Metadata
Tested with
Devices(s): Nokia Lumia 710
Compatibility
Platform(s): Windows Phone 7.5
Windows Phone 7.5
Dependencies: NonLinear Navigation Services
Article
Keywords: Circular Navigation, Silverlight for Windows Phone, NonLinear Navigation Services
Translated:
By Jeffrey.Halimsetiawan
Last edited: hamishwillee (02 Jul 2013)

Contents

[edit] Introduction

In the "standard" Windows Phone Silverlight application model, users move linearly "forward" through pages and can then use the "back" button to retract through previously visited pages, and finally to exit. Windows Phone navigation history maintains a "last-in, first-out" structure called "back-stack". This provision makes it easy to implement a linear path forward and back through navigated pages.

However it is possible to directly navigate to an arbitrary URI from any page, and this can result in navigation to a URI that is already in the back-stack, creating a loop. This can result in confusing navigation for the end user. Consider for example, if the user can navigates to "Home" rather than unwinding the page stack as shown in the game Petualangan Aksara di Tanah Jawa below:

CircularNavigationIllustrat.jpg

Users expect to exit the game when they press the back button from the home page, but because of the loop they will be taken back to a previously navigated "stage" page.

One solution to overcome this problem is to use a NonLinear Navigation Services[1] library developed by Windows Phone Recipes. This library automatically unwinds any loops if it detects that you're navigating to a page that is already in the back stack.

[edit] Using the library

The steps for using this library are straightforward:

  1. Download File:NonLinear-WP-SLApp-Navigation-Service.zip
  2. Add NonLinearNavigationServices project in the Solution which has been created.
  3. Initialize the service at the end of class constructor whose class is the inheritance of Application class.
    NonLinearNavigationService.Instance.Initialize(RootFrame);

[edit] Summary

With NonLinear Navigation Services, developers can more easily develop applications because they do not need to waste a lot of time thinking about the navigation management of the application.

Good luck!

[edit] Reference

  1. Kiriaty, Yochay. 2010. Solving Circular Navigation in Windows Phone Silverlight Applications.
This page was last modified on 2 July 2013, at 14:10.
185 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×