|
using System;
using System.Globalization;
using System.Windows.Data;
namespace slMultiBinding
{
public class Bindings2ConcatString : IMultiValueConverter// IMyMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
string ret = "";
foreach (Object param in values)
{
if (param != null)
{
ret += param.ToString();
}
}
return ret;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class Num2Pow : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Math.Pow(System.Convert.ToDouble(value), System.Convert.ToDouble(parameter));
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
public class Nums2Sum : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
//return 0;
//if (values == null || (values.AsQueryable().Any(v => v == null || v == DependencyProperty.UnsetValue)))
//{
// return 0;
//}
double ret = 0;
foreach (Object param in values)
{
if (param != null)
{
ret += System.Convert.ToDouble(param);
}
}
return ret;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.