PhoneApplicationPage.State Property

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

Allows you to save transient state data on your page.

Namespace: Microsoft.Phone.Controls
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)

Syntax

Public ReadOnly Property State As IDictionary(Of String, Object)
public IDictionary<string, Object> State { get; }

Property Value

Type: System.Collections.Generic..::.IDictionary<(Of <(String, Object>)>)
Returns IDictionary<(Of <(TKey, TValue>)>).Represents a generic collection of key/value pairs.

Remarks

This property should not be used to store global state or store state that should be permanently saved, such as user data. The objects that the user places in this dictionary must be serializable. The state is accessible only during or after the OnNavigatedTo(NavigationEventArgs) method is called, or during or before the OnNavigatedFrom(NavigationEventArgs) method is called. If you implement it too early or too late, it will throw an exception. You should not use this property for excessive storage because there is a limit of 2 MB for each page and 4 MB for the entire application.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

PhoneApplicationPage Class

Microsoft.Phone.Controls Namespace