Skip to content

Class RepeaterNode

Definition

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

A structural node that accepts a collection (IEnumerable<T>) valued attribute and repeats its inner elements with each child bound to a collection element, in the same order as the collection.

public class RepeaterNode : StardewUI.Framework.Binding.IViewNode, 
    System.IDisposable

Inheritance
Object ⇦ RepeaterNode

Implements
IViewNode, IDisposable

Members

Constructors

Name Description
RepeaterNode(IValueSourceFactory, Func<Child>, IResolutionScope, IAttribute) A structural node that accepts a collection (IEnumerable<T>) valued attribute and repeats its inner elements with each child bound to a collection element, in the same order as the collection.

Properties

Name Description
Children The children of this node.
Context The currently-bound context data, used as the source for any InputBinding, OneTimeBinding, OutputBinding or TwoWayBinding attributes.
FloatingElements The floating elements for this node, if any have been created.
Views The views for this node, if any have been created.

Methods

Name Description
Dispose()
Print(StringBuilder, Boolean) Prints the string representation of this node.
Reset() Clears any Views associated with this node and resets it to the default state before it was bound.
ToString() (Overrides Object.ToString())
Update(TimeSpan) Performs the regular per-frame update for this node.

Details

Constructors

RepeaterNode(IValueSourceFactory, Func<Child>, IResolutionScope, IAttribute)

A structural node that accepts a collection (IEnumerable<T>) valued attribute and repeats its inner elements with each child bound to a collection element, in the same order as the collection.

public RepeaterNode(StardewUI.Framework.Sources.IValueSourceFactory valueSourceFactory, Func<StardewUI.Framework.Binding.IViewNode.Child> childCreator, StardewUI.Framework.Content.IResolutionScope resolutionScope, StardewUI.Framework.Dom.IAttribute repeatAttribute);
Parameters

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

childCreator   Func<Child>
Delegate for creating a new child node.

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

repeatAttribute   IAttribute
The attribute containing the collection expression.


Properties

Children

The children of this node.

public System.Collections.Generic.IReadOnlyList<StardewUI.Framework.Binding.IViewNode.Child> Children { get; }
Property Value

IReadOnlyList<Child>

Remarks

Node children represent views in potentia. Every DOM node maps to (at least) one IViewNode, but views are created lazily and may not exist for nodes with conditional attributes or other rules.


Context

The currently-bound context data, used as the source for any InputBinding, OneTimeBinding, OutputBinding or TwoWayBinding attributes.

public StardewUI.Framework.Binding.BindingContext Context { get; set; }
Property Value

BindingContext


FloatingElements

The floating elements for this node, if any have been created.

public System.Collections.Generic.IReadOnlyList<StardewUI.Layout.FloatingElement> FloatingElements { get; private set; }
Property Value

IReadOnlyList<FloatingElement>


Views

The views for this node, if any have been created.

public System.Collections.Generic.IReadOnlyList<StardewUI.IView> Views { get; private set; }
Property Value

IReadOnlyList<IView>


Methods

Dispose()

public void Dispose();

Print(StringBuilder, bool)

Prints the string representation of this node.

public void Print(System.Text.StringBuilder sb, bool includeChildren);
Parameters

sb   StringBuilder
The output builder to receive to the node's text.

includeChildren   Boolean
Whether or not to include the string representation of any/all child nodes between this node's opening and close tags. If this is false or there are no children, it will be formatted as a self-closing tag.


Reset()

Clears any Views associated with this node and resets it to the default state before it was bound.

public void Reset();
Remarks

Propagates the request down to Children, but is not required to clear Children and does not affect the Context assignment.

This is used to "unbind" the target of a structural node like ConditionalNode and in some cases prepare it for subsequent reuse.


ToString()

public override string ToString();
Returns

string


Update(TimeSpan)

Performs the regular per-frame update for this node.

public bool Update(System.TimeSpan elapsed);
Parameters

elapsed   TimeSpan
Time elapsed since last update.

Returns

Boolean

true if any aspect of the view tree from this level downward was changed, i.e. as a result of a new Context, changed context properties, invalidated assets, or the View being created for the first time; false if no changes were made.