using System;
using System.IO;
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 C1.Silverlight;
using C1.Silverlight.Data;

namespace StockPortfolio
{
    public class DeleteRowButton : GridCell
    {
        // ** ctor
        public DeleteRowButton()
        {
        }

        // delete row when button is clicked
        protected override void OnClick(EventArgs e)
        {
            DataRowView drv = Row.DataSource as DataRowView;
            if (drv != null)
            {
                drv.Row.Delete();
            }
            base.OnClick(e);
        }

        // override to suppress regular binding
        public override void ApplyData(GridRow row)
        {
            TextBlock.Foreground = new SolidColorBrush(Colors.Red);
            //base.ApplyData(data);
        }
    }
}
