Skip to end of metadata
Go to start of metadata

Intersoft ClientUI includes a powerful, journal-aware navigation framework that consisted of several key components and UI controls that works seamlessly together to deliver consistent and reliable navigation experiences throughout the application.

This topic describes the concepts of ClientUI navigation framework, common navigation scenarios, and provides guidance about how to add navigation features to your application.

On this page:

Introduction to ClientUI Navigation Framework

ClientUI Navigation Framework extends the Silverlight's navigation system with more advanced navigation features that are fundamentally required in a line-of-business navigation application, such as journal-aware child navigation support, friendly error page, busy state management and more. Consequently, many of the navigation architecture has been completely revamped in the ClientUI navigation framework. For example, the eventing architecture in the ClientUI navigation framework uses routed events as opposed to the Silverlight navigation that uses classic event handler. For more information about routed events, see Routed Events Overview.

The following sections describe the architectural overview of the ClientUI navigation framework.

At the core of the ClientUI navigation framework is the UXFrame and UXPage class that designed with particular features that allow them to work seamlessly together. The UXPage represents discrete sections of navigable content, while the UXFrame control acts as a container for the page controls which is also referred as navigation host, and facilitates navigation to pages.

In addition to UXFrame, ClientUI also includes several controls that are exposed as navigation host such as UXNavigationWindow. All navigation hosts are designed to share the same features and behaviors, and they work in the same way and manner to deliver consistent results. More details about navigation hosts are explained later in this section.
Similar to the basic navigation concept in Silverlight and WPF, you use a HyperlinkButton control to initiate a page navigation process, which is also referred as navigation source. ClientUI provides a more advanced hyperlink control called UXHyperlinkButton that takes advantage of the ClientUI navigation framework.
Note that UXHyperlinkButton is only one of many navigation source available in ClientUI. This means that you can initiate page navigation using a variety of UI controls that support navigation source, such as UXToolBarButton, UXDockButton, UXMenuItem, UXStackItem and more, which allows for dynamic user interface that expose consistent navigation experience. The navigation source concept is explained later in this section.

Within a navigation host such as UXFrame, you can specify that a certain URI pattern maps to a particular page. URI mapping enables you to create URIs that are descriptive of the user action instead of a path to a file. For example, you can specify that any request for /Home is actually a request for the file at /Views/Home.xaml. Any request that does not match one of the defined patterns is handled as a regular URI request and is not mapped to a different page.

You add URI mapping to a frame by defining an instance of the UriMapper class and any number of UriMapping instances. The pattern you specify does not have to be the exact URI to match against the requested URI. The pattern can include placeholder segments in the URI that will match any value in that segment. The placeholder segment, which is enclosed with curly braces ( { and } ), acts as a variable when mapping to the URI. Any value that is not enclosed in curly braces represents a literal value that must be present for the URI to match the pattern.

The following table shows examples of URI mapping definitions and how example requests are resolved.

URI Mapping DefinitionExample of Matching URIResolved URI

Uri="/Home"

MappedUri="/Views/Home.xaml"

/Home/Views/Home.xaml

Uri="/Register"

MappedUri="/Views/Login/RegisterForm.xaml"

/Register/Views/Login/RegisterForm.xaml

Uri="/{page}"

MappedUri="/Views/{page}Form.xaml

/Customers/Views/CustomersForm.xaml

In a typical business application, you may want to pass certain data to display the information related to that particular data. For example, passing the CustomerID to the customer details page to see the customer information of that particular CustomerID. You can use the query string pattern to pass your data similar to the way you would do in a normal HTML page.

The URI mapping in ClientUI navigation framework recognizes the query string segmentation prefixed with ? and & character, and automatically converts the query string into key value pair which can be accessed in the code behind of the navigated page.

The following table shows the examples of query string pattern in URI mapping definitions.

URI Mapping DefinitionExample of Matching URIResolved URI

Uri="/Customers/{ID}"

MappedUri="/Views/Customers.xaml?ID={ID}"

/Customers/SMITH/Views/Customers.xaml?ID=SMITH

Uri="/Products/{category}"

MappedUri="/Views/Products.xaml?category={category}"

/Products/books/Views/Products.xaml?category=books

Uri="/Reports/{type}/{quarter}/{mode}

MappedUri="/Views/Reports/{type}.xaml?q={quarter}&mode={mode}

/Reports/Sales/1/3DPie/Views/Reports/Sales.xaml?q=1&mode=3DPie

The ClientUI navigation framework also introduces child navigation feature to support hierarchical navigation topology which is explained later in this section.

The following examples show how to add navigation features to your application by implementing the UXPage and UXFrame, as well as configuring the URI mapping definitions.

You implement a UXPage by creating a new XAML page and define the <Intersoft:UXPage> markup as the root type of the XAML such as shown in the following example.

UXPage1.xaml

You can add a UXFrame to your existing XAML page in the similar way as you would add a control. In a typical application, you add the UXFrame in a certain node where the portion of the layout represents the navigable content. It is also common to add UXFrame in the main page of your application. The following example shows a XAML page with a static header area for branding, and a dynamic content area to display navigable pages.

XAML

Note that although you can use UserControl or other container types to host a frame, it is best practice to use UXPage to host the frame in typical navigation applications. The use of UXPage allows for further extensibility when the page needs to be hosted in a larger composite navigation application. In this case, you do not need to rewrite your page to support the composite application scenario.

The following example shows how to setup UXHyperlinkButton to facilitate navigation to pages. 

XAML

As described in the above sections, you can use a variety of UI controls that support navigation source to facilitate navigation to pages. Similar to the above example, you can use UXNavigationButton to perform navigation to pages by setting its NavigateUri to a particular URI. 

XAML

To streamline the navigation application development in Silverlight and WPF, ClientUI provides predefined page templates and project templates that are integrated to Visual Studio 2010 and Expression Blend.

You can quickly jump start a rich navigation application by creating a new Visual Studio project based on the predefined project templates such as Basic Navigation Application and Advanced Navigation Application template. The following illustration shows the project templates available in ClientUI.

For more information about the project templates, see Introduction to ClientUI Project Templates.

Once you have defined the navigation structure for your application, you can rapidly add new pages to your application and add navigation source to associate the navigation to the new pages. You can add new UXPage from within the Visual Studio 2010 or Blend Expression, specifically from the New Item dialog box.

The following illustration shows the UXPage and other available item templates in Visual Studio 2010.

To learn more about the designer features supported in ClientUI, see Development Environment Overview.

In a typical ClientUI navigation application, you group all logical pages into the Views folder. This allows for streamlined project maintenance particularly when you use MVVM pattern development. The following figure illustrates the navigation application model using ClientUI.

For step-by-step guidance to create navigation application with ClientUI, see Walkthrough: Create Basic Website Navigation Application. For more walkthroughs on using ClientUI navigation framework, see Navigation Walkthroughs.

Supported Navigation Topologies

When building a navigation application, it is important to define the navigation structure and pattern that suitable to your application. As each application has its own unique experience, you should design your application to expose the navigation interface and patterns that make sense to your users. A good navigation application typically implements an intuitive navigation system that is simple and easy to use.

The way you arrange your navigation structure, that is, the correlation between the UXFrame and the UXPage that navigates to other pages in the application, is also referred as navigation topologies.

ClientUI navigation framework supports most of the navigation topologies commonly used in business applications, which are subsequently discussed in the following sections.

The linear navigation topology is analogous to the structure of a wizard that has one or more pages that are navigated in a fixed sequence. For example, the application typically started with an initial page such as MainPage.xaml. When the Next button is clicked, the application navigates to the subsequent page such as Step1.xaml and so on.

The following illustration shows the high-level structure and flow of a wizard with a linear topology.

In typical business applications, a particular page allows navigation to one or more pages existed in the application. Called hierarchical topology, it is one of the most commonly used topology in a business application. For example, consider a Welcome page in an application that contains links to popular pages such as shown in the following illustration.

One of the unique features in ClientUI navigation framework is the support for nested hierarchical topology. This topology allows your application to define another frame inside the page that already hosted in a upper level frame. The nested hierarchical topology is typically used in a more advanced line-of-business applications that comprises of chained modules such as in master-detail scenario.

For example, consider an inventory application that shows a list of available products in the left section of the page, and the details of the product in the right section of the page. In this case, the content can be refactored into two pages, one for the listing and another for the details. This design pattern allows for better code reusability, maintainability and extensibility.

The following illustration shows a master-detail scenario in a typical inventory application that use nested hierarchical topology.

In addition to the common navigation topologies described in the above sections, ClientUI also supports navigation to the content located in external application package (.xap). When the location of the external package is determined, the ClientUI navigation framework will download the package asynchronously and display the content as if the content were located internally in the project.

The remote on-demand navigation, and many other related features are explained later in the Advanced Topics section.

The navigation topologies that described in the above sections fully supports journal integration with web browser, which is often referred as journal-aware navigation. The journal integration is one of the most important concepts in a well-designed browser application, which improves the application usability and accessibility in overall.

With journal-aware navigation feature, you can access to a particular part of your application directly from the browser by typing directly in the browser's address bar or load the Url from the browser's history or favorite list. This also means that you can use your browser's Back and Forward button to navigate the journal history of your navigation session.

The journal-aware navigation takes advantage of the URI mapping concept described in the earlier section. The URI mapping uses the bookmark feature of the browser to identify the path of the navigation segments. For example, you can see the inventory list by typing the full path to the Silverlight page, and then followed with the bookmark character and the path of the destination content to be navigated. In this example, the path would be something like http://domain/ClientUIApp1.html#/Inventory.

The UXFrame supports both browser-integrated mode and local navigation mode, which is determined by the JournalOwnership property of the frame. To enable journal-aware navigation, make sure the JournalOwnership property is set to Automatic, which is the default value. In a browser-integrated frame, navigating to the pages that occurred within the frame will automatically synchronize the path of the target navigation to the browser's address bar. This is particularly useful for users to bookmark or add the current page to the Favorite list in the browser.

The following illustration shows several examples of the web browser-integrated navigation.

Navigation Hosts and Navigation Sources

ClientUI advances the navigation framework further by identifying the navigation patterns commonly used in business applications and then implementing these patterns consistently into the navigators and the user interface controls that consume the navigation features.

The ClientUI navigation framework is conceptualized into the following architecture:

  • Navigation Host
    Navigation hosts are controls that facilitates navigation to pages which typically implement INavigate interface. Two of the included navigation hosts in ClientUI are UXFrame and UXNavigationWindow.

When a navigation source initiates a navigation process, it searches for the specified navigation host in the page or the nearest navigation host, and execute the navigation process on the matching host. The following illustration shows the overall architecture of navigation hosts and navigation sources, and how they correlate between each other.

With solid navigation architecture such as described above, you can create a rich user interface that exposes consistent and intuitive navigation experiences. For example, you can design your user interface in a way that allows users to navigate to Customers page from various ways such as from Accordion, Toolbar, MenuBar or ContextMenu.

Controls that implement INavigationSource support navigation to both local and external XAML pages. In addition, it also supports navigation to external website pages and supports a number of safe protocols such as http and mailto. You can also set the target window for the navigation by specifying one of the following values: _blank, _self_parent and _top. The default value is _self.

To learn more about using various UI controls for navigating pages, see How-to: Use Menu Bar, Tool Bar and Context Menu as Navigation Source.

Navigation Controls

ClientUI provides user interface controls that take advantage of the navigation framework such as UXJournalButtons and UXNavigationBar. With professionally designed journal buttons in Aero-style interface and combined with predefined navigation commands such as refresh, stop and home button, you can quickly add navigation controls to your navigation application.

When you add a UXNavigationBar control to your page, it will automatically recognize the navigation host that existed in the page. The navigation commands will automatically work as expected without additional code or settings. For example, navigating to a new page will invalidate the journal buttons, pressing back button will navigate to the previous journal. The other commands will reflect to the new navigation state as well.

For a guided walkthrough on using UXNavigationBar in a navigation application, see Walkthrough: Create Basic Navigation Application using MVVM Pattern.

Navigation Events and Lifetime

ClientUI navigation framework is built upon routed events architecture for consistency with other class library available in ClientUI framework. Consequently, many of the events, event arguments and delegates in the Silverlight navigation framework are overridden with the new types introduced in ClientUI. 

All the new types use API name, parameter and signature that are identical with the existing types in the base class to provide seamless migration and code compatibility between the Silverlight and the ClientUI class library. In most cases, you do not need to concern about the types difference as the UXPage template is provided in the New Item dialog box, integrated to both Visual Studio 2010 and Expression Blend. For more information about the supported development enviroments, see Development Environment Overview.

By incorporating more powerful architecture such as routed events, many advanced features can be implemented in the ClientUI navigation framework. For example, a navigation button will be automatically selected when user navigates to the page that matches its NavigateUri. This feature allows you to build navigation application more rapidly without requiring extensive code writing. For more information about routed events concept, see Routed Events Overview.

The following list describes the events that are raised by UXFrame during the navigation process:

  • Navigating. Occurs when a new navigation is requested. Can be used to cancel the navigation.
  • ResolveNavigationDirection. Occurs when the navigation framework attempts to resolve the direction of the target page.
  • NavigationProgress. Occurs periodically during a download to provide navigation progress information.
  • RequestingAuthentication. Occurs when the destination page is requesting authentication before the content is displayed.
  • Navigated. Occurs when the page has been located and downloaded.
  • FragmentNavigation. Occurs when navigation to a content fragment begins.
  • NavigationCancelled. Occurs when the navigation is cancelled by user, such as when the Stop command is executed.
  • NavigationStopped. Occurs when the navigation is stopped by calling StopLoading method, or when a new navigation is requested while a current navigation is in progress.
  • NavigationFailed. Occurs when an error is raised while navigating to the requested content.

The navigation events are raised in the order that is illustrated by the following figure.

In many cases, you may be interested to subscribe to the events that are raised at the UXPage class instead of the events in the UXFrame class. The UXPage class provides a number of protected methods that you can override in the code behind of your page such as the OnNavigatedTo method. These protected methods are called internally by the ClientUI navigation framework, and are consistent with the flow of the main navigation events raised by the navigation frame.

The protected methods in the UXPage class are particularly useful to obtain contextual information related to the page being navigated. It is also useful in modular application design where the page needs to execute certain logics in a navigation event, but does not aware of the existence of the UXFrame.

The following example shows how to override the OnNavigatedTo method to obtain the query string that passed from the navigation context, set the data context and display the data accordingly.

C#

The OnNavigatedTo method override such as shown in the above example might be not ideal for MVVM pattern implementation which requires user interaction logic to be implemented in ViewModel. Custom navigation logic using MVVM pattern is supported through the use of command. For more information, see NavigatedCommand.

The following list describes the protected methods available in the UXPage class that are called by the ClientUI navigation framework during navigation process:

  • OnNavigatedTo. Called when the page has been successfully navigated and loaded.
  • OnNavigatingFrom. Called just before a page is no longer the active page in a frame.
  • OnNavigatedFrom. Called when a page is no longer the active page in a frame.
  • OnChildNavigation. Called when a page loads the child page in a nested frame.
  • OnApplicationInitialized. Called when a page that dynamically downloaded from an external ApplicationPackage is instantiated for the first time. 

Navigation Commands

The ClientUI navigation framework is built around the commanding semantics which allows certain features of the navigation to be executed through declarative definition in the XAML markup. The commanding semantics is also an ideal approach for MVVM pattern development.

ClientUI already includes several predefined commands for navigation that you can use in your application. Please note that even though the commands are provided, some of them do not contain built-in implementation. You will need to create the command binding and attach the logic to respond the commands.

The following commands are implemented directly in the ClientUI navigation framework and can be used directly in your application.

The following commands are available for general command identifier and do not contain implementation. They may be reserved for future implementation.

The following example shows how to configure a button to navigate to a page using the Navigate routed command. 

XAML

For more information on using commanding, see Commanding Overview. For more information on application development using MVVM pattern, see MVVM Pattern Overview.

Advanced Topics

This overview describes the basics that you need to know to get started with navigation application using ClientUI navigation framework. The ClientUI navigation framework also includes a number of advanced features that you may be interested in, such as navigating to an external content in remote XAP, configuring child navigation, using authentication features and more.

To learn more about these advanced features, see Advanced Features in ClientUI Navigation Framework.