using System;
using System.Globalization;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace LiveCharts.Uwp.Components.MultiBinding
{
///
/// An abstract implementation to be used with the .
///
public abstract class MultiValueConverterBase : DependencyObject, IValueConverter
{
///
/// Modifies the source data before passing it to the target for display in the UI.
///
/// The value to be passed to the target dependency property.
/// The source data being passed to the target.
/// The of data expected by the target dependency property.
/// An optional parameter to be used in the converter logic.
/// The culture of the conversion.
public abstract object Convert(object[] values, Type targetType, object parameter, CultureInfo culture);
///
/// Modifies the target data before passing it to the source object. This method is called only in bindings.
///
/// The value to be passed to the source object.
/// The target data being passed to the source.
/// The of data expected by the source object.
/// An optional parameter to be used in the converter logic.
/// The culture of the conversion.
public abstract object[] ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);
object IValueConverter.Convert(object value, Type targetType, object parameter, string language)
{
var cultureInfo = !string.IsNullOrEmpty(language) ? new CultureInfo(language) : null;
return Convert((object[])value, targetType, parameter, cultureInfo);
}
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, string language)
{
var cultureInfo = !string.IsNullOrEmpty(language) ? new CultureInfo(language) : null;
return ConvertBack(value, targetType, parameter, cultureInfo);
}
}
}