State Property
Collapse the table of content
Expand the table of content

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)

public IDictionary<string, Object> State { get; }

Property Value

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

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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft