using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace RealTimeGraphX.WPF.Converters
{
///
/// Converts an instance of and a string format expression to a formated string representation of the data point.
///
///
public class IGraphDataPointToStringConverter : IMultiValueConverter
{
///
/// Converts source values to a value for the binding target. The data binding engine calls this method when it propagates the values from source bindings to the binding target.
///
/// The array of values that the source bindings in the produces. The value indicates that the source binding has no value to provide for conversion.
/// The type of the binding target property.
/// The converter parameter to use.
/// The culture to use in the converter.
///
/// A converted value.If the method returns , the valid value is used.A return value of . indicates that the converter did not produce a value, and that the binding will use the if it is available, or else will use the default value.A return value of . indicates that the binding does not transfer the value or use the or the default value.
///
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length == 2 && values[0] != null)
{
if (values[1] != null)
{
return (values[0] as IGraphDataPoint).ToString(values[1].ToString());
}
else
{
return (values[0] as IGraphDataPoint).ToString();
}
}
else
{
return null;
}
}
///
/// Converts a binding target value to the source binding values.
///
/// The value that the binding target produces.
/// The array of types to convert to. The array length indicates the number and types of values that are suggested for the method to return.
/// The converter parameter to use.
/// The culture to use in the converter.
///
/// An array of values that have been converted from the target value back to the source values.
///
///
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}