Skip to content

Class AttributeBindingFactory

Definition

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

A general IAttributeBindingFactory implementation using dependency injection for all resolution.

public class AttributeBindingFactory : 
    StardewUI.Framework.Binding.IAttributeBindingFactory

Inheritance
Object ⇦ AttributeBindingFactory

Implements
IAttributeBindingFactory

Members

Constructors

Name Description
AttributeBindingFactory(IValueSourceFactory, IValueConverterFactory) A general IAttributeBindingFactory implementation using dependency injection for all resolution.

Methods

Name Description
TryCreateBinding(IViewDescriptor, IAttribute, BindingContext, IResolutionScope) Attempts to creates a new attribute binding.

Details

Constructors

AttributeBindingFactory(IValueSourceFactory, IValueConverterFactory)

A general IAttributeBindingFactory implementation using dependency injection for all resolution.

public AttributeBindingFactory(StardewUI.Framework.Sources.IValueSourceFactory valueSourceFactory, StardewUI.Framework.Converters.IValueConverterFactory valueConverterFactory);
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.


Methods

TryCreateBinding(IViewDescriptor, IAttribute, BindingContext, IResolutionScope)

Attempts to creates a new attribute binding.

public StardewUI.Framework.Binding.IAttributeBinding TryCreateBinding(StardewUI.Framework.Descriptors.IViewDescriptor viewDescriptor, StardewUI.Framework.Dom.IAttribute attribute, StardewUI.Framework.Binding.BindingContext context, StardewUI.Framework.Content.IResolutionScope resolutionScope);
Parameters

viewDescriptor   IViewDescriptor
Descriptor for the bound view, providing access to its properties.

attribute   IAttribute
The attribute data.

context   BindingContext
The binding context, including the bound data and descriptor for the data type.

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

Returns

IAttributeBinding

The created binding, or null if the arguments do not support creating a binding, such as an attribute bound to a null value of context.