Keine Beschreibung

NameConverter.cs 823B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Data;
  6. using System.Globalization;
  7. using System.Windows;
  8. namespace WpfApplication19
  9. {
  10. public class NameConverter : IMultiValueConverter
  11. {
  12. public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
  13. {
  14. string name;
  15. Console.WriteLine(values[0].ToString());
  16. if (values[0] == DependencyProperty.UnsetValue)
  17. {
  18. return "";
  19. }
  20. name = values[0] + "-" + values[1];
  21. return name;
  22. }
  23. public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
  24. {
  25. string[] splitValues = ((string)value).Split(' ');
  26. return splitValues;
  27. }
  28. }
  29. }