using System.Windows; using System.Windows.Controls; using System.Windows.Media; namespace SJ.Controls { [StyleTypedProperty(Property = "Style", StyleTargetType = typeof(BButton))] public class BButton : Button { static BButton() { DefaultStyleKeyProperty.OverrideMetadata(typeof(BButton), new FrameworkPropertyMetadata(typeof(BButton))); } public static readonly DependencyProperty BorderCornerRadiusProperty = DependencyProperty.Register("BorderCornerRadius", typeof(CornerRadius), typeof(BButton)); public static readonly DependencyProperty MouseOverBgColorProperty = DependencyProperty.Register("MouseOverBgColor", typeof(Brush), typeof(BButton)); public static readonly DependencyProperty MouseOverFontColorProperty = DependencyProperty.Register("MouseOverFontColor", typeof(Brush), typeof(BButton)); public static readonly DependencyProperty PressedBgColorProperty = DependencyProperty.Register("PressedBgColor", typeof(Brush), typeof(BButton)); public static readonly DependencyProperty PressedFontColorProperty = DependencyProperty.Register("PressedFontColor", typeof(Brush), typeof(BButton)); public static readonly DependencyProperty DisableBgColorProperty = DependencyProperty.Register("DisableBgColor", typeof(Brush), typeof(BButton)); public static readonly DependencyProperty DisableTextProperty = DependencyProperty.Register("DisableText", typeof(string), typeof(BButton)); public static readonly DependencyProperty PressedScaleProperty = DependencyProperty.Register("PressedScale", typeof(bool), typeof(BButton), new PropertyMetadata(true)); public CornerRadius BorderCornerRadius { get { return (CornerRadius)GetValue(BorderCornerRadiusProperty); } set { SetValue(BorderCornerRadiusProperty, value); } } public Brush MouseOverBgColor { get { return GetValue(MouseOverBgColorProperty) as Brush; } set { SetValue(MouseOverBgColorProperty, value); } } public Brush MouseOverFontColor { get { return GetValue(MouseOverFontColorProperty) as Brush; } set { SetValue(MouseOverFontColorProperty, value); } } public Brush PressedBgColor { get { return GetValue(PressedBgColorProperty) as Brush; } set { SetValue(PressedBgColorProperty, value); } } public Brush PressedFontColor { get { return GetValue(PressedFontColorProperty) as Brush; } set { SetValue(PressedFontColorProperty, value); } } public Brush DisableBgColor { get { return GetValue(DisableBgColorProperty) as System.Windows.Media.Brush; } set { SetValue(DisableBgColorProperty, value); } } public string DisableText { get { return GetValue(DisableTextProperty).ToString(); } set { SetValue(DisableTextProperty, value); } } public bool PressedScale { get { return (bool)GetValue(PressedScaleProperty); } set { SetValue(PressedScaleProperty, value); } } } }