using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;

namespace ConditionalDateFormat
{
    public class MyStyleSelector : StyleSelector 
    {
        public override Style SelectStyle(object item, DependencyObject container)
        {
            var style= new Style(typeof(GridViewCell));
            var cell = (GridViewCell)container;
            var obj = (Item)item;
            if (obj.Date == DateTime.FromOADate(0))
            { 
                style.Setters.Add(new Setter(GridViewCell.BackgroundProperty, new SolidColorBrush(Colors.LightGray)));
            } 
            else 
            {
                style.Setters.Add(new Setter(GridViewCell.BackgroundProperty, new SolidColorBrush(Colors.White)));
            } 
            
            return style;
        }
    }
}
