public object ConvertBack(object value, Type targetType, object parameter, string language) { Setting setting = new Setting(); SolidColorBrush brushValue = value as SolidColorBrush; int intValue; if (brushValue == setting.CellCorrectBackgroundColor) intValue = 1; if (brushValue == setting.CellIncorrectBackgroundColor) intValue = 2; if (brushValue == setting.CellHoverBackgroundColor) intValue = 3; else intValue = 0; return intValue; }
public object Convert(object value, Type targetType, object parameter, string language) { Setting setting = new Setting(); int intValue = (int)value; SolidColorBrush brush; if (intValue == 1) brush = setting.CellCorrectBackgroundColor; else if (intValue == 2) brush = setting.CellIncorrectBackgroundColor; else if (intValue == 3) brush = setting.CellHoverBackgroundColor; else brush = setting.CellBackgroundColor; return brush; }