1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;
namespace FLY.Winder.UI.Client.Converter
{
public class IsGTMultiValueConverter : IMultiValueConverter
{
/// <summary>
/// values[0] 大于 values[1] 返回true
/// values[0] 小于等于 values[1] 返回false
/// 类型不对,返回 false
/// </summary>
/// <param name="values"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Count() != 3)
return false;
double[] v = new double[3];
for (int i = 0; i < 3; i++)
{
if (!double.TryParse(values[i].ToString(), out v[i]))
return false;
}
if (v[0] > v[1] - v[2])
return true;
return false;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}