Basic Concept
FRAME
- The concept of Navigation system revolves around Frame . Frame Control acts as a container for pages
, it validate the state and maintain the navigation history.
- A Frame can host one page at particular time.
- Source : Source property of Frame defines the default page
to load when the application initialized.
- Navigate (URI uri) :Navigate Method navigates to the
specific URI from code.
PAGE
- Pages are the superset of controls which is capable
of Navigation and allow it self to load inside a frame.

- It is important to know the relation between Frame and Page.The above fig
illustrate the relation between them.Frame is responsible for navigate to a
particular page with the URI .Once page loaded it can access the host Navigation
system by NavigationContext and NavigationService.
Step By Step with a Example
CREATE A SILVERLIGHT APPLICATION
- Lets create a Silverlight Application from Visual Studio.As shown in fig we
have added some pages to the Silverlight project.
- The MainPage will load the content pages (In View Folder) with a click of
navigation Hyperlinks.
ADD EVENT HANDLER TO NAVIGATE
For the project XAMl code
of the MainPage as follows .
Notice the
HyperlinkButton "Home" click Event. It call the code behind logic of navigating
to the particular page.
private void hlHome_Click(object sender, RoutedEventArgs e)
{
this.frameContainer.Navigate(new Uri("/View/Home.xaml", UriKind.Relative ));
}
ADD ERROR PAGE FOR RESOURCE NOT FOUND
private void frameContainer_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e)
{
e.Handled = true;
frameContainer.Navigate(new Uri("/View/ErrorPage.xaml", UriKind.Relative));
}
Navigation Through XAML
Instead of above coding
approach we can specify Hyperlink NavigateUri property to the their relative
URIs .
Hiding Resources Through URI Mapper
- Our Next step will be adding mapping to the Frame Control.
Now we need to set the
Hyperlink navigateURI. property as /"Customers ".So this will ensure that the
"/Customer" is mapped to the mentioned MapeedUri.
Now
,Customers page can be accessible by the new User friendly URI.
"http://localhost:6469/NavigationSystemTestPage.aspx#/Customers"
Accessing Navigation System from a Page
- As we mentioned above a page can access navigation system using
NavigationService. In this example we have a DashBoard page which required to be
loaded once the user clicks on the button in the customers page. This can be
achieved by through code behind in Customers page on button click event
.
private void btnShowDashBoard_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Admin/DashBoard.xaml", UriKind.Relative));
}
NavigationService allows the page to get the host
navigation service that used to navigate to this page.

Final Words
Silverlight navigation support much more
complex navigation logic such Fragmented Navigation ,Content loader etc..This
post only touches the basics of navigation.More posts will follow soon about
navigation and Silverlight .