NavigationCacheMode Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Specifies how the page is cached when used within a frame.

Namespace:  System.Windows.Navigation
Assembly:  System.Windows.Controls.Navigation (in System.Windows.Controls.Navigation.dll)


Public Enumeration NavigationCacheMode
public enum NavigationCacheMode


Member name Description
Disabled The page is never cached and a new instance of the page is created on each visit.
Required The page is cached and the cached instance is reused for every visit regardless of the cache size for the frame.
Enabled The page is cached, but the cached instance is discarded when the size of the cache for the frame is exceeded.


You use the NavigationCacheMode enumeration when setting the NavigationCacheMode property of the Page class. You specify whether a new instance of the page is created for each visit to the page or whether a previously constructed instance of the page that has been saved in the cache is used for each visit.

The default value for the NavigationCacheMode property is Disabled. Set the NavigationCacheMode property to Enabled or Required when a new instance of the page is not essential for each visit. By using a cached instance of the page, you can improve the performance of your application and reduce the load on your server. Set the NavigationCacheMode property to Disabled if a new instance must be created for each visit. For example, you should not cache a page that displays information that is unique to each customer.

The OnNavigatedTo method is called for each request, even when the page is retrieved from the cache. You should include in this method code that must be executed for each request rather than placing that code in the Page constructor.


The following example shows a Silverlight page that retrieves and displays data from a data source. The data that is retrieved is the performance schedule for an arts organization for the current month. The page is not likely to change often and the data retrieval is potentially time-consuming, so the NavigationCacheMode property is set to Enabled. The implementation of the data retrieval and display is not shown in this example.

<!-- NOTE: 
  By convention, the sdk prefix indicates a URI-based XAML namespace declaration 
  for Silverlight SDK client libraries. This namespace declaration is valid for 
  Silverlight 4 only. In Silverlight 3, you must use individual XAML namespace 
  declarations for each CLR assembly and namespace combination outside the scope 
  of the default Silverlight XAML namespace. For more information, see the help 
  topic "Prefixes and Mappings for Silverlight Libraries". 
    Title="Current Month's Performance Schedule" 

    <!-- Retrieve and display all performances for this month. -->
    <Grid x:Name="LayoutRoot">


Version Information


Supported in: 5, 4, 3


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.