Skip to content

Class ViewFactory

Definition

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

A view factory based on per-tag delegates. Can be used as a base class for other view factories.

public class ViewFactory : StardewUI.Framework.Binding.IViewFactory

Inheritance
Object ⇦ ViewFactory

Implements
IViewFactory

Members

Constructors

Name Description
ViewFactory()

Methods

Name Description
CreateView(string) Creates a new view.
Register<TView>(string) Registers a view for a given tag using the view's default parameterless constructor.
Register(string, Func<IView>) Registers a view for a given tag using a delegate function.
SupportsTag(string) Checks if the factory can create views corresponding to a specific tag.

Details

Constructors

ViewFactory()

public ViewFactory();

Methods

CreateView(string)

Creates a new view.

public virtual StardewUI.IView CreateView(string tagName);
Parameters

tagName   string
The markup tag that specifies the type of view.

Returns

IView

A new view of a type corresponding to the tagName.


Register<TView>(string)

Registers a view for a given tag using the view's default parameterless constructor.

public void Register<TView>(string tagName);
Parameters

tagName   string
The markup tag corresponding to the TView type.


Register(string, Func<IView>)

Registers a view for a given tag using a delegate function.

public void Register(string tagName, Func<StardewUI.IView> tagFactory);
Parameters

tagName   string
The markup tag to handle.

tagFactory   Func<IView>
Delegate function to create the view corresponding to the tagName.


SupportsTag(string)

Checks if the factory can create views corresponding to a specific tag.

public virtual bool SupportsTag(string tagName);
Parameters

tagName   string
The markup tag that specifies the type of view.

Returns

Boolean

true if this factory should handle the specified tagName, otherwise false.