using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace 智慧物流软件系统 { public class ListToString : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) return ""; if (value is string) { return value.ToString(); } else if (value is List) { List strList = new List(); string sep = parameter == null ? "," : parameter.ToString(); foreach (var item in value as List) { strList.Add(item.ToString()); } return string.Join(sep, strList); } return ""; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotSupportedException(); } } }