34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Windows.Data;
|
|
using System.Windows.Markup;
|
|
using System.Windows.Media;
|
|
using BeWo.ViewModel;
|
|
using DevExpress.Xpf.Grid;
|
|
|
|
namespace BeWo.Converter
|
|
{
|
|
public class CellColorConverter : MarkupExtension, IMultiValueConverter
|
|
{
|
|
public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
Brush b = new SolidColorBrush(Color.FromArgb(255, 233, 233, 233));
|
|
|
|
if (value[1].ToString().Equals(string.Empty))
|
|
return b;
|
|
|
|
var cellData = value[0] as EditGridCellData;
|
|
var viewTag = cellData.View.Tag as List<AdditionalServiceBookingVM>;
|
|
var date = int.Parse(value[1].ToString().Split('.')[0], NumberStyles.Integer);
|
|
|
|
return viewTag.Any(v => v.Date.Day.Equals(date)) ? Brushes.White : b;
|
|
}
|
|
|
|
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); }
|
|
|
|
public override object ProvideValue(IServiceProvider serviceProvider) { return this; }
|
|
}
|
|
}
|