CellForeColorConverter.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Data;
  6. using System.Windows.Media;
  7. using Xceed.Wpf.DataGrid;
  8. using System.Data;
  9. using System.Windows;
  10. namespace Aitex.UI.RecipeEditor
  11. {
  12. public class CellForeColorConverter : IMultiValueConverter
  13. {
  14. public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  15. {
  16. var cell = values[0] as DataCell;
  17. if (cell == null) return Brushes.Black;
  18. RecipeEditorControlViewModel controlViewModel = values[1] as RecipeEditorControlViewModel;
  19. if (controlViewModel == null) return Brushes.Black;
  20. if (!(cell.DataContext is DataRowView)) return Brushes.Black;
  21. var dataRowView = cell.DataContext as DataRowView;
  22. System.Data.DataRow row = dataRowView.Row;
  23. int currentRowIndex = row.Table.Rows.IndexOf(row);
  24. return Brushes.Black;
  25. }
  26. public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
  27. {
  28. return null;
  29. }
  30. }
  31. }