Skip to content

Interface IAttributeBinding

Definition

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

Binding instance for a single attribute on a single view.

public interface IAttributeBinding : System.IDisposable

Implements
IDisposable

Remarks

Encapsulates the source of the value and provides a method to update the target view if the value has changed.

This is primarily for internal use, as a way of tracking fine-grained changes to views instead of having to rebind the entire view when anything changes.

Members

Properties

Name Description
DestinationPropertyName The name of the bound property on the destination view.
Direction The data flow direction for this binding.

Methods

Name Description
GetBoundValue() Gets the current value bound for this attribute, regardless of the view's actual value.
UpdateSource(IView) Updates the source to match the view's current value.
UpdateView(IView, Boolean) Updates a target view with the most recent source value.

Details

Properties

DestinationPropertyName

The name of the bound property on the destination view.

string DestinationPropertyName { get; }
Property Value

string


Direction

The data flow direction for this binding.

StardewUI.Framework.Binding.BindingDirection Direction { get; }
Property Value

BindingDirection


Methods

GetBoundValue()

Gets the current value bound for this attribute, regardless of the view's actual value.

System.Object GetBoundValue();
Returns

Object

The currently bound value, or null if the value does not exist or cannot be determined, for example in the case of an OutputBinding.

Remarks

This method performs conversion (if necessary) from the source type to the destination type, but does not look at the destination view itself. It can be used to determine what the view's value "should be", which is part of the behavior system.

Alternatively, this can be thought of as the value that the view would have after calling UpdateView(IView, Boolean) with the force argument set to true.


UpdateSource(IView)

Updates the source to match the view's current value.

void UpdateSource(StardewUI.IView target);
Parameters

target   IView
The bound view.

Remarks

Allowed when the Direction is either Out or InOut.


UpdateView(IView, bool)

Updates a target view with the most recent source value.

bool UpdateView(StardewUI.IView target, bool force);
Parameters

target   IView
The view to receive the update.

force   Boolean
If true, always re-publishes the latest value to the view even if the source value has not changed. Typically used for initial updates immediately after creation.

Returns

Boolean

true if the view was updated; false if the update was skipped because the source value had not changed.

Remarks

Allowed when the Direction is either In or InOut.