Skip to content

Class ValueSourceFactory

Definition

Namespace: StardewUI.Framework.Sources
Assembly: StardewUI.dll

Default implementation of the IValueSourceFactory supporting all binding types.

public class ValueSourceFactory : 
    StardewUI.Framework.Sources.IValueSourceFactory

Inheritance
Object ⇦ ValueSourceFactory

Implements
IValueSourceFactory

Members

Constructors

Name Description
ValueSourceFactory(IAssetCache) Default implementation of the IValueSourceFactory supporting all binding types.

Methods

Name Description
GetValueSource(Type, IArgument, BindingContext) Creates a value source that supplies values of a given type according to the specified argument binding.
GetValueSource<T>(IArgument, BindingContext) Creates a value source that supplies values according to the specified argument binding.
GetValueSource(Type, IAttribute, BindingContext, IResolutionScope) Creates a value source that supplies values of a given type according to the specified binding attribute.
GetValueSource<T>(IAttribute, BindingContext, IResolutionScope) Creates a value source that supplies values according to the specified binding attribute.
GetValueType(IArgument, BindingContext) Determines the type of value that will be supplied by a given argument binding, and with the specified context.
GetValueType(IAttribute, IPropertyDescriptor, BindingContext) Determines the type of value that will be supplied by a given attribute binding, and with the specified context.

Details

Constructors

ValueSourceFactory(IAssetCache)

Default implementation of the IValueSourceFactory supporting all binding types.

public ValueSourceFactory(StardewUI.Framework.Content.IAssetCache assetCache);
Parameters

assetCache   IAssetCache
The current asset cache, for any asset-scoped bindings.


Methods

GetValueSource(Type, IArgument, BindingContext)

Creates a value source that supplies values of a given type according to the specified argument binding.

public StardewUI.Framework.Sources.IValueSource GetValueSource(System.Type type, StardewUI.Framework.Dom.IArgument argument, StardewUI.Framework.Binding.BindingContext context);
Parameters

type   Type
The type of value to obtain; can be determined using GetValueType(IArgument, BindingContext).

argument   IArgument
The parsed markup argument containing the binding info.

context   BindingContext
The binding context to use for any contextual bindings (those with ContextBinding).

Returns

IValueSource


GetValueSource<T>(IArgument, BindingContext)

Creates a value source that supplies values according to the specified argument binding.

public StardewUI.Framework.Sources.IValueSource<T> GetValueSource<T>(StardewUI.Framework.Dom.IArgument argument, StardewUI.Framework.Binding.BindingContext context);
Parameters

argument   IArgument
The parsed markup argument containing the binding info.

context   BindingContext
The binding context to use for any contextual bindings (those with InputBinding, OneTimeBinding, OutputBinding or TwoWayBinding).

Returns

IValueSource<T>


GetValueSource(Type, IAttribute, BindingContext, IResolutionScope)

Creates a value source that supplies values of a given type according to the specified binding attribute.

public StardewUI.Framework.Sources.IValueSource GetValueSource(System.Type type, StardewUI.Framework.Dom.IAttribute attribute, StardewUI.Framework.Binding.BindingContext context, StardewUI.Framework.Content.IResolutionScope resolutionScope);
Parameters

type   Type
The type of value to obtain; can be determined using GetValueType(IArgument, BindingContext).

attribute   IAttribute
The parsed markup attribute containing the binding info.

context   BindingContext
The binding context to use for any contextual bindings (those with ContextBinding).

resolutionScope   IResolutionScope

Returns

IValueSource


GetValueSource<T>(IAttribute, BindingContext, IResolutionScope)

Creates a value source that supplies values according to the specified binding attribute.

public StardewUI.Framework.Sources.IValueSource<T> GetValueSource<T>(StardewUI.Framework.Dom.IAttribute attribute, StardewUI.Framework.Binding.BindingContext context, StardewUI.Framework.Content.IResolutionScope resolutionScope);
Parameters

attribute   IAttribute
The parsed markup attribute containing the binding info.

context   BindingContext
The binding context to use for any contextual bindings (those with InputBinding, OneTimeBinding, OutputBinding or TwoWayBinding).

resolutionScope   IResolutionScope

Returns

IValueSource<T>


GetValueType(IArgument, BindingContext)

Determines the type of value that will be supplied by a given argument binding, and with the specified context.

public System.Type GetValueType(StardewUI.Framework.Dom.IArgument argument, StardewUI.Framework.Binding.BindingContext context);
Parameters

argument   IArgument
The parsed markup argument containing the binding info.

context   BindingContext
The binding context to use for any contextual bindings (those with ContextBinding).

Returns

Type

Remarks

This provides the type argument that must be supplied to GetValueSource(Type, IArgument, BindingContext).


GetValueType(IAttribute, IPropertyDescriptor, BindingContext)

Determines the type of value that will be supplied by a given attribute binding, and with the specified context.

public System.Type GetValueType(StardewUI.Framework.Dom.IAttribute attribute, StardewUI.Framework.Descriptors.IPropertyDescriptor property, StardewUI.Framework.Binding.BindingContext context);
Parameters

attribute   IAttribute
The parsed markup attribute containing the binding info.

property   IPropertyDescriptor
Binding metadata for the destination property; used when the source does not encode any independent type information. If not specified, some attribute values may be unsupported.

context   BindingContext
The binding context to use for any contextual bindings (those with InputBinding, OneTimeBinding, OutputBinding or TwoWayBinding).

Returns

Type

Remarks

This provides the type argument that must be supplied to GetValueSource(Type, IArgument, BindingContext).