using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using Tango.MachineStudio.Logging.ViewModels; namespace Tango.MachineStudio.Logging.Converters { public class DateIsInListToBooleanConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values.Length < 2 || !(values[0] is DateTime) || !(values[1] is IEnumerable)) return false; var date = (DateTime)values[0]; var dateList = (IEnumerable)values[1]; return dateList.ToList().Exists(x => x.ToLocalTime().ToShortDateString() == date.ToLocalTime().ToShortDateString()); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }