Class ViewNode
Definition
Namespace: StardewUI.Framework.Binding
Assembly: StardewUI.dll
Internal structure of a view node, encapsulating dependencies required for data binding and lazy creation/updates.
Inheritance
Object ⇦ ViewNode
Implements
IViewNode, IDisposable
Members
Constructors
Name | Description |
---|---|
ViewNode(IValueSourceFactory, IValueConverterFactory, IViewFactory, IViewBinder, SElement, IResolutionScope, ViewBehaviors, IAttribute, IAttribute) | Internal structure of a view node, encapsulating dependencies required for data binding and lazy creation/updates. |
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
ViewNode(IValueSourceFactory, IValueConverterFactory, IViewFactory, IViewBinder, SElement, IResolutionScope, ViewBehaviors, IAttribute, IAttribute)
Internal structure of a view node, encapsulating dependencies required for data binding and lazy creation/updates.
public ViewNode(StardewUI.Framework.Sources.IValueSourceFactory valueSourceFactory, StardewUI.Framework.Converters.IValueConverterFactory valueConverterFactory, StardewUI.Framework.Binding.IViewFactory viewFactory, StardewUI.Framework.Binding.IViewBinder viewBinder, StardewUI.Framework.Dom.SElement element, StardewUI.Framework.Content.IResolutionScope resolutionScope, StardewUI.Framework.Binding.ViewBehaviors behaviors, StardewUI.Framework.Dom.IAttribute contextAttribute, StardewUI.Framework.Dom.IAttribute floatAttribute);
Parameters
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 types required by the target view.
viewFactory
IViewFactory
Factory for creating views, based on their tag names.
viewBinder
IViewBinder
Binding service used to create IViewBinding instances that detect changes to data or assets and propagate them to the bound IView.
element
SElement
Element data for this node.
resolutionScope
IResolutionScope
Scope for resolving externalized attributes, such as translation keys.
behaviors
ViewBehaviors
Behavior extensions for this node.
contextAttribute
IAttribute
Optional attribute specifying how to resolve the context for child nodes based on this node's assigned Context.
floatAttribute
IAttribute
Optional attribute designating that the node should be a FloatingElement and specifying how to resolve its Position.
Properties
Children
The children of this node.
public System.Collections.Generic.IReadOnlyList<StardewUI.Framework.Binding.IViewNode.Child> Children { get; set; }
Property Value
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.
Property Value
FloatingElements
The floating elements for this node, if any have been created.
public System.Collections.Generic.IReadOnlyList<StardewUI.Layout.FloatingElement> FloatingElements { get; }
Property Value
IReadOnlyList<FloatingElement>
Views
The views for this node, if any have been created.
Property Value
Methods
Dispose()
Print(StringBuilder, bool)
Prints the string representation of this node.
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.
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()
Returns
Update(TimeSpan)
Performs the regular per-frame update for this node.
Parameters
elapsed
TimeSpan
Time elapsed since last update.
Returns
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.