using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Data; using System.Windows; using System.Windows.Media; namespace Aitex.UI.RecipeEditor { class ErrTooltipConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { if (value == null) return " 0 Error"; var errors = value as List>; string errStr = string.Format("Found {0} erros\r\n", errors.Count); int index = 1; foreach (var e in errors) { errStr += string.Format("\r\n({0}). step {1},Line {2},{3},{4}。", index++, e.Item2 + 1, e.Item1 + 1, e.Item3, e.Item4); } return errStr; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } return " Unknown Error"; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return null; } } }