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.GridView;
using Telerik.Windows.Controls;

namespace SparkLinesInGridView
{
    public class MyCellStyleSelector : StyleSelector
    {
        public override System.Windows.Style SelectStyle(object item, System.Windows.DependencyObject container)
        {
            Style style = new Style(typeof(GridViewCell));
            StockData stockData = item as StockData;

            if (stockData != null && stockData.Change > 0.5)
            {
                style.Setters.Add(new Setter(GridViewCell.ForegroundProperty, new SolidColorBrush(Colors.Red)));
            }

            return style;
        }
    }
}
