Interface IViewState
Definition
Namespace: StardewUI.Framework.Behaviors
Assembly: StardewUI.dll
Provides access to all state-based overrides associated with a view.
Members
Methods
Name | Description |
---|---|
GetDefaultValue<T>(string) | Retrieves the default value for a given property. |
GetFlag<T>(string) | Gets the current value of a flag, if one is set. |
GetOrAddProperty<T>(string) | Gets the override states for the specified property, creating a new one if it does not already exist. |
GetProperty<T>(string) | Gets the override states for the specified property, if any exist. |
SetFlag(string, Object) | Sets an arbitrary flag that other behaviors can read and/or be notified about. |
Write(IView) | Writes the active overrides to the target view. |
Events
Name | Description |
---|---|
FlagChanged | Event raised when a flag changes, i.e. as the outcome of SetFlag(string, Object). |
Details
Methods
GetDefaultValue<T>(string)
Retrieves the default value for a given property.
Parameters
propertyName
string
The property name.
Returns
T
The default value for the specified propertyName
.
Remarks
The default value is the value that will be used when there are no states for that property, i.e. when GetProperty<T>(string) returns null
for the specified propertyName
or when the property's states are empty.
Defaults are real-time; if the property is linked via data binding, then the default value is the value that is currently bound.
GetFlag<T>(string)
Gets the current value of a flag, if one is set.
Parameters
name
string
The flag name.
Returns
T
The flag value, or the default of T
if not set.
GetOrAddProperty<T>(string)
Gets the override states for the specified property, creating a new one if it does not already exist.
Parameters
propertyName
string
The property name.
Returns
The state overrides for the specified property on the current view.
GetProperty<T>(string)
Gets the override states for the specified property, if any exist.
Parameters
propertyName
string
The property name.
Returns
The state overrides for the specified property, or null
if none have been added.
SetFlag(string, Object)
Sets an arbitrary flag that other behaviors can read and/or be notified about.
Parameters
name
string
The flag name.
value
Object
The flag value, or null
to unset.
Write(IView)
Writes the active overrides to the target view.
Parameters
view
IView
The view that should receive the state/overrides.
Events
FlagChanged
Event raised when a flag changes, i.e. as the outcome of SetFlag(string, Object).