Skip to content

Interface IBehaviorFactory

Definition

Namespace: StardewUI.Framework.Behaviors
Assembly: StardewUI.dll

Factory for creating IViewBehavior instances from markup data.

public interface IBehaviorFactory

Members

Methods

Name Description
CanCreateBehavior(string, string) Checks if the factory can create behaviors with a specified name and argument.
CreateBehavior(Type, string, string) Creates a new behavior.

Details

Methods

CanCreateBehavior(string, string)

Checks if the factory can create behaviors with a specified name and argument.

bool CanCreateBehavior(string name, string argument);
Parameters

name   string
The behavior name.

argument   string
The argument for the behavior, if any. Most implementations can ignore this parameter, but in some cases it is used for disambiguation.

Returns

Boolean

true if this factory should handle the specified name, when given the specified argument, otherwise false.


CreateBehavior(Type, string, string)

Creates a new behavior.

StardewUI.Framework.Behaviors.IViewBehavior CreateBehavior(System.Type viewType, string name, string argument);
Parameters

viewType   Type
The specific type of IView that will receive the behavior.

name   string
The behavior name that specifies the type of behavior.

argument   string
Additional argument provided in the markup, distinct from the behavior's DataType. Enables prefixed behaviors such as tween:opacity

Returns

IViewBehavior

A new behavior of a type corresponding to the name.