using System;
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.Legacy;

namespace StockPortfolio
{
    public class SPButton : C1Button
    {
        public SPButton()
        {
            Padding = new Thickness(4, 3, 4, 3);
            Clip = null;
        }
        protected override ResourceInfo ResourceName
        {
            get { return new ResourceInfo("SPButton.xaml", this.GetType().Assembly); }
        }
        protected override void InitializeFont()
        {
            // to preserve xaml font, don't call base
        }
        protected override void PerformLayout()
        {
            base.PerformLayout();
            Rectangle glow = FindName("Glow") as Rectangle;
            Rect rc = new Rect(0, 0, Width, Height);
            rc.Inflate(-2, -2);
            C1ControlBase.SetBounds(glow, rc);
        }
        protected override void OnLoaded(EventArgs e)
        {
            base.OnLoaded(e);

            // remove clipping to allow zoom effect
            for (FrameworkElement f = this; f != null; f = f.Parent as FrameworkElement)
            {
                f.Clip = null;
            }
        }
    }
}
