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 "质检完成"; } return "未派"; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { // 如果需要双向绑定,也需要实现 ConvertBack 方法 throw new NotImplementedException(); } } }