Class TranslationValueSource
Definition
Namespace: StardewUI.Framework.Sources
Assembly: StardewUI.dll
Value source that reads the localized string from a translation key.
public class TranslationValueSource :
StardewUI.Framework.Sources.IValueSource<string>,
StardewUI.Framework.Sources.IValueSource
Inheritance
Object ⇦ TranslationValueSource
Implements
IValueSource<string>, IValueSource
Members
Constructors
Name | Description |
---|---|
TranslationValueSource(IResolutionScope, string) | Value source that reads the localized string from a translation key. |
Properties
Name | Description |
---|---|
CanRead | Whether or not the source can be read from, i.e. if an attempt to get the Value should succeed. |
CanWrite | Whether or not the source can be written back to, i.e. if an attempt to set the Value should succeed. |
DisplayName | Descriptive name for the property, used primarily for debug views and log/exception messages. |
Value | |
ValueType | The compile-time type of the value tracked by this source; the type parameter for IValueSource<T>. |
Methods
Name | Description |
---|---|
Update(Boolean) | Checks if the value needs updating, and if so, updates Value to the latest. |
Details
Constructors
TranslationValueSource(IResolutionScope, string)
Value source that reads the localized string from a translation key.
Parameters
scope
IResolutionScope
The scope providing access to translation values.
key
string
The translation key.
Properties
CanRead
Whether or not the source can be read from, i.e. if an attempt to get the Value should succeed.
Property Value
CanWrite
Whether or not the source can be written back to, i.e. if an attempt to set the Value should succeed.
Property Value
DisplayName
Descriptive name for the property, used primarily for debug views and log/exception messages.
Property Value
Value
Property Value
ValueType
The compile-time type of the value tracked by this source; the type parameter for IValueSource<T>.
Property Value
Methods
Update(bool)
Checks if the value needs updating, and if so, updates Value to the latest.
Parameters
force
Boolean
If true
, forces the source to update its value even if it isn't considered dirty. This should never be used in a regular binding, but can be useful in sources that are intended for occasional or one-shot use such as event handler arguments.
Returns
true
if the Value was updated; false
if it already held the most recent value.
Remarks
This method is called every frame, for every binding, and providing a correct return value is essential in order to avoid slowdowns due to unnecessary rebinds.