NavigationContext Class
Represents the state of a navigation operation.
Namespace: System.Windows.Navigation
Assembly: System.Windows.Controls.Navigation (in System.Windows.Controls.Navigation.dll)
The NavigationContext type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
You use the NavigationContext class to retrieve the query string values for a navigation request. With the query string values, you can generate the desired state of a page for a navigation request. For example, you can store in the query string the identifier of the record you wish to display on a page.
To access an instance of the NavigationContext class, you use the NavigationContext property of the Page class.
The following example shows how to override the OnNavigatedTo in a Silverlight page and obtain a query string value from the NavigationContext object. The query string value is used to determine which product is retrieved from a data service and displayed in the page.
Protected Overrides Sub OnNavigatedTo(ByVal e As System.Windows.Navigation.NavigationEventArgs) Dim productID As String Dim svcContext As DataServiceContext svcContext = New DataServiceContext(New Uri("AdventureWorks.svc", _ UriKind.Relative)) If (Me.NavigationContext.QueryString.ContainsKey("ProductId")) Then productID = Me.NavigationContext.QueryString("ProductId") Else productID = App.Current.Resources("FeaturedProductID").ToString() End If svcContext.BeginExecute(Of Product)(New Uri("Product(" + productID + ")", _ UriKind.Relative), AddressOf loadProductCallback, svcContext) End Sub Private Sub loadProductCallback(ByVal asyncResult As IAsyncResult) Dim context As DataServiceContext context = asyncResult.AsyncState ListBox1.DataContext = context.EndExecute(Of Product)(asyncResult) End Sub
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.


