Class ConditionalFlagBehavior
Definition
Namespace: StardewUI.Framework.Behaviors
Assembly: StardewUI.dll
Updates a view state flag with a boolean value corresponding to the behavior's data.
Inheritance
Object ⇦ ViewBehavior<TView, TData> ⇦ ConditionalFlagBehavior
Remarks
Essentially enables arbitrary state names to be linked with context properties that are boolean-valued or convertible to boolean, primarily as a bridge for the FlagStateBehavior<TValue> which in turn allows property changes to be associated with the state. In other words, part one of the two-part process used to create conditional attributes.
Members
Constructors
Name | Description |
---|---|
ConditionalFlagBehavior(string) | Updates a view state flag with a boolean value corresponding to the behavior's data. |
Properties
Name | Description |
---|---|
Data | The assigned or bound data. (Inherited from ViewBehavior<TView, TData>) |
View | The currently-attached view. (Inherited from ViewBehavior<TView, TData>) |
ViewState | State overrides for the View. (Inherited from ViewBehavior<TView, TData>) |
Methods
Name | Description |
---|---|
CanUpdate() | Checks whether the behavior is allowed to Update(TimeSpan). (Inherited from ViewBehavior<TView, TData>) |
Dispose() | (Inherited from ViewBehavior<TView, TData>) |
Initialize(BehaviorTarget) | Initializes the target (view, state overrides, etc.) for the behavior. (Inherited from ViewBehavior<TView, TData>) |
OnAttached() | Runs after the behavior is attached to a target. (Overrides ViewBehavior<TView, TData>.OnAttached()) |
OnDetached(IView) | Runs when the behavior is detached from a target. (Inherited from ViewBehavior<TView, TData>) |
OnDispose() | Runs when the behavior is being disposed. (Inherited from ViewBehavior<TView, TData>) |
OnNewData(Boolean) | (Overrides ViewBehavior<TView, TData>.OnNewData(TData)) |
PreUpdate(TimeSpan) | Runs on every update tick, before any bindings or views update. (Inherited from ViewBehavior<TView, TData>) |
Update(TimeSpan) | Runs on every update tick. (Inherited from ViewBehavior<TView, TData>) |
Details
Constructors
ConditionalFlagBehavior(string)
Updates a view state flag with a boolean value corresponding to the behavior's data.
Parameters
flagName
string
Name of the flag to set when Data is true
.
Remarks
Essentially enables arbitrary state names to be linked with context properties that are boolean-valued or convertible to boolean, primarily as a bridge for the FlagStateBehavior<TValue> which in turn allows property changes to be associated with the state. In other words, part one of the two-part process used to create conditional attributes.
Methods
OnAttached()
Runs after the behavior is attached to a target.
Remarks
Setup code should go in this method to ensure that the values of View and ViewState are actually assigned. If code runs in the behavior's constructor, these are not guaranteed to be populated.
OnNewData(bool)
Parameters
previousData
Boolean