using System;
using System.Globalization;
using System.Windows.Data;
namespace BPA.UIControl.Converters
{
///
/// 是否为大弧形
///
public class IsLargeArcConverter : IMultiValueConverter
{
///
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length < 3)
{
throw new ArgumentException("参数少于 3 个");
}
double value = System.Convert.ToDouble(values[0]);
double min = System.Convert.ToDouble(values[1]);
double max = System.Convert.ToDouble(values[2]);
double percent = value / (max - min) > 1 ? 1 : value / (max - min);
double angle = percent * 360;
return angle > 180;
}
///
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}
}