NavigationCacheMode Enumeration

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

Namespace:  System.Windows.Navigation
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)

Syntax

Public Enumeration NavigationCacheMode
public enum NavigationCacheMode
<object property="enumerationValue" .../>

Members

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.

Remarks

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 #ctor()()() constructor.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

System.Windows.Navigation Namespace

CacheSize

NavigationCacheMode

Other Resources

In-app navigation for Windows Phone 8