Using List Navigation
To create navigation application in Windows Phone, simply create a new view page class that derive from Intersoft’s PhoneApplicationPage Class. With the specified ViewModel, view page automatically reads the navigation source from the Items property of the ViewModel.
Let assume that you have a ViewModel with the following navigation items.
The next step is simply creating a XAML that consumes the ViewModel.
Note that you will need to enable NavigationService.EnableItemNavigation in LongListSelector control, or any List control. Also specify the NavigationService.DetailNavigationTarget to target View Model
As seen in the image, when the application runs, Crosslight automatically discovers the navigation source, configures the view grouping style and prepares the list item accordingly to indicate a navigation flow. See the following screenshot for the result.
The NavigationItem Class includes several properties such as title, category, image and the target ViewModel type to navigate. To learn more about NavigationItem Class and the basic of navigation concept in Crosslight, see Designing Consistent Navigation Interface.
Using Tabbed Navigation
Aside from list navigation, tabbed navigation is also a common navigation pattern in mobile apps. In Windows Phone, tabbed navigation is introduced in a new fashion with two new types of Page, called as Pivot and Panorama page. Crosslight provides a specialized Pivot page that supports ViewModel. The specialized pivot automatically reads the navigation source from the Items property of the ViewModel. Selection-related properties are automatically synchronized in two-way mode, allowing you to change selected pivot page from within the ViewModel.
The next step is simply creating a XAML class that consumes the ViewModel.
The code behind
This illustration is the result of code above,
As illustrated, the Pivot page will produce pivot item as much as user need. Often times, you want to control the selection from the ViewModel. For instance, you would like to navigate the screen to the second tab when user tapped on a button. This can be easily done by implementing the PhonePivotPage Class.
Cuztomizing Navigation Parameter
Crosslight for Windows Phone natively supports most of the parameter exposed in the NavigationParameter Class which can be optionally passed to the navigation service.Following list describes the properties that affect the navigation behaviors in Windows Phone:
Specifies the navigation mode to apply to the navigation session. Supported values: Push and Modal. The default value is Push.
Indicates whether the animation transition should be applied when navigating. The default value is true.
Specifies the transition style when performing modal navigation. Supported values: Default, Slide, Flip, Fade and Curl. By default, the value is chosen based on the mobile platform standard UI guidelines.
Specifies an identifier to the command that invoke the navigation. This is an optional value and is meant to provide a way for developers to recognize a particular command that raise the navigation then perform additional actions based on the identifier.
For most cases, you can create a new instance of NavigationParameter Class and set the properties that you desire, then pass it to the Navigate method overload that accepts navigation parameter. This is the easiest and standard way to perform navigation with customized behaviors.
For more information about the fundamentals of Crosslight navigation, see Designing Consistent Navigation Interface.