Class ItemStateManagerBase
Provides a base implementation for managing visual states of RadControl items. Handles state transitions, validation, and fallback mechanisms for theming.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.Styles
Assembly: Telerik.WinControls.dll
Syntax
public abstract class ItemStateManagerBase
Constructors
ItemStateManagerBase()
Initializes a new instance of the ItemStateManagerBase class.
Declaration
public ItemStateManagerBase()
Fields
stateDelimiter
The delimiter character used to separate state names.
Declaration
public const char stateDelimiter = '.'
Field Value
|
System.Char
|
Properties
DefaultVisibleStates
Gets the collection of default visible states for this state manager.
Declaration
public IEnumerable<string> DefaultVisibleStates { get; }
Property Value
|
System.Collections.Generic.IEnumerable<System.String>
An enumerable collection of default visible state names. |
Methods
AddDefaultVisibleState(String)
Adds a state to the default visible states collection.
Declaration
public void AddDefaultVisibleState(string state)
Parameters
|
System.String
state
The state name to add. |
Exceptions
|
System.InvalidOperationException
Thrown if the state is not recognized by the state manager. |
AttachToItem(RadObject)
Attaches this state manager to the specified item, enabling state management.
Declaration
public virtual StateManagerAttachmentData AttachToItem(RadObject item)
Parameters
|
RadObject
item
The RadObject item to attach to. |
Returns
|
StateManagerAttachmentData
Attachment data for the state manager connection. |
AttachToItemOverride(StateManagerAttachmentData, RadObject)
Provides derived classes with the opportunity to perform custom attachment logic.
Declaration
protected abstract void AttachToItemOverride(StateManagerAttachmentData attachData, RadObject item)
Parameters
|
StateManagerAttachmentData
attachData
The attachment data for the state manager connection. |
|
RadObject
item
The RadObject item being attached to. |
CombineStateNames(String, String)
Combines state names, using stateDelimiter Character.
Declaration
public static string CombineStateNames(string stateName, string stateName1)
Parameters
|
System.String
stateName
The first state name. |
|
System.String
stateName1
The second state name to combine. |
Returns
|
System.String
The combined state name using the delimiter. |
Remarks
E.g. combining "Selected" and "MouseOver" gives "Selected.MouseOver"; combining "" and "MouseOver" gives "MouseOver"
Detach(StateManagerAttachmentData)
Detaches the state manager from an item, cleaning up resources.
Declaration
public virtual void Detach(StateManagerAttachmentData data)
Parameters
|
StateManagerAttachmentData
data
The attachment data to detach. |
GetAvailableStates(String)
Gets the available states for the specified theme role. Must be implemented by derived classes.
Declaration
public abstract StateDescriptionNode GetAvailableStates(string themeRoleName)
Parameters
|
System.String
themeRoleName
The theme role name to get states for. |
Returns
|
StateDescriptionNode
The root state description node containing all available states. |
GetInitialState(RadObject)
Gets the initial state for the specified RadObject item. Uses the ThemeRole if the item is stylable, otherwise uses the type name.
Declaration
public virtual string GetInitialState(RadObject item)
Parameters
|
RadObject
item
The item to get the initial state for. |
Returns
|
System.String
The initial state string for the item. |
GetStateFallbackList(RadItem)
Gets a fallback list of states for the specified item, providing progressively less specific states.
Declaration
public IEnumerable<string> GetStateFallbackList(RadItem item)
Parameters
|
RadItem
item
The RadItem to get state fallbacks for. |
Returns
|
System.Collections.Generic.IEnumerable<System.String>
An enumerable collection of fallback state names. |
GetStateFullName(String, String)
Gets the full state name by combining the item theme role with the state name.
Declaration
public string GetStateFullName(string itemThemeRole, string stateName)
Parameters
|
System.String
itemThemeRole
The theme role of the item. |
|
System.String
stateName
The state name to combine. |
Returns
|
System.String
The full state name combining theme role and state. |
ItemStateChanged(RadObject, RadPropertyChangedEventArgs)
Handles item state changes. Must be implemented by derived classes.
Declaration
public abstract void ItemStateChanged(RadObject senderItem, RadPropertyChangedEventArgs changeArgs)
Parameters
|
RadObject
senderItem
The RadObject item that changed state. |
|
RadPropertyChangedEventArgs
changeArgs
The property change event arguments. |
RemoveDefaultVisibleState(String)
Removes a state from the default visible states collection.
Declaration
public void RemoveDefaultVisibleState(string state)
Parameters
|
System.String
state
The state name to remove. |
Exceptions
|
System.InvalidOperationException
Thrown if the state is not recognized by the state manager. |
SetItemState(RadObject, String[])
Combines ThemeRoleName with state names using "." as delimiter and sets the result to AttachedElement.Class
Declaration
protected void SetItemState(RadObject item, params string[] stateNames)
Parameters
|
RadObject
item
The RadObject item to set state for. |
|
System.String[]
stateNames
Array of state names to combine. |
VerifyState(String)
Verifies if the specified state is valid for this state manager.
Declaration
public bool VerifyState(string state)
Parameters
|
System.String
state
The state string to verify. |
Returns
|
System.Boolean
True if the state is valid; otherwise, false. |
VerifyState(String, String)
Verifies if the specified state is valid for the given theme role.
Declaration
public virtual bool VerifyState(string themeRoleName, string key)
Parameters
|
System.String
themeRoleName
The theme role name to validate against. |
|
System.String
key
The state key to verify. |
Returns
|
System.Boolean
True if the state is valid; otherwise, false. |