using System.Windows;
using System.Windows.Media;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;

namespace SilverlightApplication1
{
    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;
        }
    }
}
