Page.NavigationCacheMode Property

Definition

Gets or sets the navigation mode that indicates whether this Page is cached, and the period of time that the cache entry should persist.

Equivalent WinUI property: Microsoft.UI.Xaml.Controls.Page.NavigationCacheMode.

public:
 property NavigationCacheMode NavigationCacheMode { NavigationCacheMode get(); void set(NavigationCacheMode value); };
NavigationCacheMode NavigationCacheMode();

void NavigationCacheMode(NavigationCacheMode value);
public NavigationCacheMode NavigationCacheMode { get; set; }
var navigationCacheMode = page.navigationCacheMode;
page.navigationCacheMode = navigationCacheMode;
Public Property NavigationCacheMode As NavigationCacheMode
<page NavigationCacheMode="navigationCacheModeMemberName" />

Property Value

NavigationCacheMode

A value of the enumeration. The default is Disabled.

Examples

For example code that uses NavigationCacheMode, see Navigation. For a complete sample that uses many of the Page and Frame features together, see XAML Navigation sample.

Remarks

To enable a page to be cached, set NavigationCacheMode to either Enabled or Required. The difference in behavior is that Enabled might not be cached if the frame's cache size limit (CacheSize ) is exceeded, whereas Required always generates an entry no matter the size limit.

If you want to change the value of NavigationCacheMode programmatically to Enabled or Required, you can only set these values in the constructor for the page.

If you change the value of NavigationCacheMode from Required or Enabled to Disabled, the page is flushed from the cache. The page is not simply marked as available to be flushed when the configured CacheSize is exceeded.

Applies to

See also