using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace XGLFinishPro.Tools { public class MyValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { // 根据输入值返回对应的输出值 已派发w1未派w0活动w2报工w3 if (value.Equals("w1")) { return "已派发"; } if (value.Equals("w2")) { return "活动"; } if (value.Equals("w3")) { return "报工"; } if (value.Equals("w4")) { return "暂停"; } if (value.Equals("w0")) { return "未派"; } if (value.Equals("0") || string.IsNullOrEmpty(value.ToString())) { return "未首检"; } if (value.Equals("1")) { return "首检中"; } if (value.Equals("2")) { return "首检完成"; } if (value.Equals("Y")) { return "合格"; } if (value.Equals("N")) { return "不合格"; } if (value.Equals(" ")) { return ""; } return "未派"; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { // 如果需要双向绑定,也需要实现 ConvertBack 方法 throw new NotImplementedException(); } } }