SearchResWidth.cs 982 B

123456789101112131415161718192021222324252627282930313233
  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;
  8. using System.Windows.Data;
  9. namespace GeekDesk.Converts
  10. {
  11. class SearchResWidth : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. string param = parameter as string;
  16. if ("1".Equals(param))
  17. {
  18. double menuLeftWidth = double.Parse(value.ToString());
  19. return MainWindow.mainWindow.Width - menuLeftWidth;
  20. } else
  21. {
  22. double menuLeftWidth = double.Parse(value.ToString());
  23. return (MainWindow.mainWindow.Width - menuLeftWidth) / 2;
  24. }
  25. }
  26. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  27. {
  28. return null;
  29. }
  30. }
  31. }