You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 1 година
1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Globalization;
  3. using System.Windows;
  4. using System.Windows.Data;
  5. namespace BPA.UIControl.Converters
  6. {
  7. /// <summary>
  8. /// 两个数 -> 点
  9. /// </summary>
  10. public class DoublesToPointConverter : IMultiValueConverter
  11. {
  12. /// <inheritdoc/>
  13. public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. if (values.Length < 2)
  16. {
  17. throw new ArgumentException("参数少于 2 个");
  18. }
  19. double x = System.Convert.ToDouble(values[0]);
  20. double y = System.Convert.ToDouble(values[1]);
  21. return new Point(x, y);
  22. }
  23. /// <inheritdoc/>
  24. public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
  25. {
  26. return null;
  27. }
  28. }
  29. }