How do I use the targetType parameter in an IValueConverter?
This should work without too much overhead:
public object Convert(
object value, Type targetType, object parameter, CultureInfo culture)
{
double result = ... // your math
return System.Convert.ChangeType(result, targetType);
}
you can do this
var typeCode = Type.GetTypeCode(targetType); // Pass in your target type
if(typeCode == TypeCode.Int32)
{
// it is int type
}