终端一体化运控平台
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.

ZoomConverter.cs 840 B

2 vuotta sitten
12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Data;
  8. namespace BeDesignerSCADA.Converters
  9. {
  10. public class ZoomConverter : IValueConverter
  11. {
  12. public bool IsHeight { get; set; }
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. if (double.TryParse(value.ToString(), out double zoom))
  16. {
  17. return IsHeight ? zoom * 1080 : zoom * 1920;
  18. }
  19. else
  20. {
  21. return IsHeight ? 1080 : 1920;
  22. }
  23. }
  24. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  25. {
  26. return value;
  27. }
  28. }
  29. }