Skip to content

Class ViewBehaviors

Definition

Namespace: StardewUI.Framework.Binding
Assembly: StardewUI.dll

Wrapper for the entire set of behaviors attached to a single node/view.

public class ViewBehaviors : System.IDisposable

Inheritance
Object ⇦ ViewBehaviors

Implements
IDisposable

Members

Constructors

Name Description
ViewBehaviors(IEnumerable<IAttribute>, IBehaviorFactory, IValueSourceFactory, IValueConverterFactory, IResolutionScope) Wrapper for the entire set of behaviors attached to a single node/view.

Methods

Name Description
Dispose()
PreUpdate(TimeSpan) Runs on every update tick, before any bindings or views update.
SetContext(BindingContext) Updates or removes the binding context for all managed behaviors.
SetTarget(BehaviorTarget) Updates the attached target (view and state) for all managed behaviors.
Update(TimeSpan) Runs on every update tick.

Details

Constructors

ViewBehaviors(IEnumerable<IAttribute>, IBehaviorFactory, IValueSourceFactory, IValueConverterFactory, IResolutionScope)

Wrapper for the entire set of behaviors attached to a single node/view.

public ViewBehaviors(System.Collections.Generic.IEnumerable<StardewUI.Framework.Dom.IAttribute> behaviorAttributes, StardewUI.Framework.Behaviors.IBehaviorFactory behaviorFactory, StardewUI.Framework.Sources.IValueSourceFactory valueSourceFactory, StardewUI.Framework.Converters.IValueConverterFactory valueConverterFactory, StardewUI.Framework.Content.IResolutionScope resolutionScope);
Parameters

behaviorAttributes   IEnumerable<IAttribute>
List of all behavior attributes applied to the node.

behaviorFactory   IBehaviorFactory
Factory for creating behaviors.

valueSourceFactory   IValueSourceFactory
The factory responsible for creating IValueSource<T> instances from attribute data.

valueConverterFactory   IValueConverterFactory
The factory responsible for creating IValueConverter<TSource, TDestination> instances, used to convert bound values to the data types required by individual behaviors.

resolutionScope   IResolutionScope
Scope for resolving externalized attributes, such as translation keys.


Methods

Dispose()

public void Dispose();

PreUpdate(TimeSpan)

Runs on every update tick, before any bindings or views update.

public void PreUpdate(System.TimeSpan elapsed);
Parameters

elapsed   TimeSpan
Time elapsed since last tick.


SetContext(BindingContext)

Updates or removes the binding context for all managed behaviors.

public void SetContext(StardewUI.Framework.Binding.BindingContext context);
Parameters

context   BindingContext
The new context.


SetTarget(BehaviorTarget)

Updates the attached target (view and state) for all managed behaviors.

public void SetTarget(StardewUI.Framework.Behaviors.BehaviorTarget target);
Parameters

target   BehaviorTarget
The new behavior target, or null to remove behaviors.

Remarks

If the target is null then all behaviors will be disabled/removed.


Update(TimeSpan)

Runs on every update tick.

public void Update(System.TimeSpan elapsed);
Parameters

elapsed   TimeSpan
Time elapsed since last tick.