New to Telerik UI for WinForms? Start a free 30-day trial

Stores string-keyed chart state and serializes only entries marked dirty.

Definition

Namespace:Telerik.Charting

Assembly:Telerik.WinControls.RadChart.dll

Syntax:

C#
public class StateBag : IEnumerable

Inheritance: objectStateBag

Implements: IEnumerable

Constructors

C#
public StateBag()

Properties

Gets the number of stored entries, including entries that are not marked dirty.

C#
public int Count { get; }

Gets whether TrackViewState() has been called; this flag does not mark entries dirty.

C#
public bool IsTrackingViewState { get; }

Gets all keys stored in the bag, including entries that are not marked dirty.

C#
public ICollection Keys { get; }

Gets or sets the value associated with a key. New keys must be strings, and assignment does not mark an entry dirty.

C#
public object this[object key] { get; set; }
Parameters:keyobject

String key identifying the entry.

Property Value:

The value stored for the key, or null when no entry exists.

Methods

Adds a new state entry. Use the indexer to update an existing entry.

C#
public void Add(string key, object value)
Parameters:keystring

String key that identifies the entry.

valueobject

Value to store.

Exceptions: ArgumentException

An entry with the same key already exists.

Determines whether the bag contains the specified key, regardless of its dirty state.

C#
public bool Contains(string key)
Parameters:keystring

String key to look for.

Returns:

bool

true if the key exists; otherwise, false.

Returns an enumerator over the stored key and StateItem pairs.

C#
public IEnumerator GetEnumerator()
Returns:

IEnumerator

An enumerator whose entries are DictionaryEntry values.

Implements: IEnumerable.GetEnumerator()

Gets the state entry for a key.

C#
public StateItem GetStateItem(string key)
Parameters:keystring

String key to look for.

Returns:

StateItem

The entry, or null if the key is not present.

Merges entries from a state snapshot into this bag. A null state is ignored; keys not present in the snapshot are left unchanged.

C#
public void LoadViewState(object state)
Parameters:stateobject

An ArrayList of StateItem entries, typically returned by SaveViewState().

Removes the specified entry if it exists.

C#
public void Remove(string key)
Parameters:keystring

String key of the entry to remove.

Creates a snapshot of entries marked dirty.

C#
public object SaveViewState()
Returns:

object

null when no entries are dirty; otherwise, an ArrayList of clean copies of the dirty entries.

Sets IsTrackingViewState to true. It does not mark entries dirty or automatically track later assignments.

C#
public void TrackViewState()