Interface IValueConverterFactory
Definition
Namespace: StardewUI.Framework.Converters
Assembly: StardewUI.dll
Factory for obtaining instance of IValueConverter<TSource, TDestination>.
Members
Methods
Name | Description |
---|---|
GetConverter<TSource, TDestination>() | Gets a converter from a given source type to a given destination type. |
GetRequiredConverter<TSource, TDestination>() | Gets a converter from a given source type to a given destination type, throwing if the conversion is not supported. |
TryGetConverter<TSource, TDestination>(IValueConverter<TSource, TDestination>) | Attempts to obtain a converter from a given source type to a given destination type. |
TryGetConverter(Type, Type, IValueConverter) | Attempts to obtain a converter from a given source type to a given destination type. |
Details
Methods
GetConverter<TSource, TDestination>()
Gets a converter from a given source type to a given destination type.
StardewUI.Framework.Converters.IValueConverter<TSource, TDestination> GetConverter<TSource, TDestination>();
Returns
IValueConverter<TSource, TDestination>
A converter that converts from TSource
to TDestination
, or null
if the conversion is not supported.
GetRequiredConverter<TSource, TDestination>()
Gets a converter from a given source type to a given destination type, throwing if the conversion is not supported.
StardewUI.Framework.Converters.IValueConverter<TSource, TDestination> GetRequiredConverter<TSource, TDestination>();
Returns
IValueConverter<TSource, TDestination>
A converter that converts from TSource
to TDestination
.
TryGetConverter<TSource, TDestination>(IValueConverter<TSource, TDestination>)
Attempts to obtain a converter from a given source type to a given destination type.
Parameters
converter
IValueConverter<TSource, TDestination>
If the method returns true
, holds the converter that converts between the specified types; otherwise null
.
Returns
true
if the conversion is supported, otherwise false
.
TryGetConverter(Type, Type, IValueConverter)
Attempts to obtain a converter from a given source type to a given destination type.
bool TryGetConverter(System.Type sourceType, System.Type destinationType, out StardewUI.Framework.Converters.IValueConverter converter);
Parameters
sourceType
Type
The type of value to be converted.
destinationType
Type
The converted value type.
converter
IValueConverter
If the method returns true
, holds the converter that converts between the specified types; otherwise null
.
Returns
true
if the conversion is supported, otherwise false
.