using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Data; namespace Aitex.UI.RecipeEditor { public class ErrItemDisplayConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { if (value == null) return ""; var list1 = value as List>; var list2 = new List(); int no = 1; foreach (var item in list1) { list2.Add(string.Format("{0}. 第{1}步,第{2}行,变量名:{3},原因:{4}", no++, item.Item2 + 1, item.Item1 + 1, item.Item3, item.Item4)); } return list2; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } return null; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return value.ToString(); } } }