using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Controls; using System.Windows.Data; namespace DyeingComputer.ConvertMoels { /// /// 序号转换器 /// 获取DataGrid的行号 , 转换为对应的序号 /// internal class RowToIndexConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { DataGridRow row = value as DataGridRow; if (row != null) return row.GetIndex() + 1; else return -1; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }