3 changed files with 694 additions and 1 deletions
@ -0,0 +1,271 @@ |
|||
using System; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
|
|||
namespace Microsoft.Windows.Controls.Chromes |
|||
{ |
|||
public class ButtonChrome : Control |
|||
{ |
|||
#region CornerRadius
|
|||
|
|||
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ButtonChrome), new UIPropertyMetadata(default(CornerRadius), new PropertyChangedCallback(OnCornerRadiusChanged))); |
|||
public CornerRadius CornerRadius |
|||
{ |
|||
get { return (CornerRadius)GetValue(CornerRadiusProperty); } |
|||
set { SetValue(CornerRadiusProperty, value); } |
|||
} |
|||
|
|||
private static void OnCornerRadiusChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnCornerRadiusChanged((CornerRadius)e.OldValue, (CornerRadius)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnCornerRadiusChanged(CornerRadius oldValue, CornerRadius newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //CornerRadius
|
|||
|
|||
#region InnerCornerRadius
|
|||
|
|||
public static readonly DependencyProperty InnerCornerRadiusProperty = DependencyProperty.Register("InnerCornerRadius", typeof(CornerRadius), typeof(ButtonChrome), new UIPropertyMetadata(default(CornerRadius), new PropertyChangedCallback(OnInnerCornerRadiusChanged))); |
|||
public CornerRadius InnerCornerRadius |
|||
{ |
|||
get { return (CornerRadius)GetValue(InnerCornerRadiusProperty); } |
|||
set { SetValue(InnerCornerRadiusProperty, value); } |
|||
} |
|||
|
|||
private static void OnInnerCornerRadiusChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnInnerCornerRadiusChanged((CornerRadius)e.OldValue, (CornerRadius)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnInnerCornerRadiusChanged(CornerRadius oldValue, CornerRadius newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //InnerCornerRadius
|
|||
|
|||
#region RenderActive
|
|||
|
|||
public static readonly DependencyProperty RenderActiveProperty = DependencyProperty.Register("RenderActive", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(false, OnRenderActiveChanged)); |
|||
public bool RenderActive |
|||
{ |
|||
get { return (bool)GetValue(RenderActiveProperty); } |
|||
set { SetValue(RenderActiveProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderActiveChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderActiveChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderActiveChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderActive
|
|||
|
|||
#region RenderChecked
|
|||
|
|||
public static readonly DependencyProperty RenderCheckedProperty = DependencyProperty.Register("RenderChecked", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(false, OnRenderCheckedChanged)); |
|||
public bool RenderChecked |
|||
{ |
|||
get { return (bool)GetValue(RenderCheckedProperty); } |
|||
set { SetValue(RenderCheckedProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderCheckedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderCheckedChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderCheckedChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderChecked
|
|||
|
|||
#region RenderEnabled
|
|||
|
|||
public static readonly DependencyProperty RenderEnabledProperty = DependencyProperty.Register("RenderEnabled", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(true, OnRenderEnabledChanged)); |
|||
public bool RenderEnabled |
|||
{ |
|||
get { return (bool)GetValue(RenderEnabledProperty); } |
|||
set { SetValue(RenderEnabledProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderEnabledChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderEnabledChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderEnabledChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderEnabled
|
|||
|
|||
#region RenderFocused
|
|||
|
|||
public static readonly DependencyProperty RenderFocusedProperty = DependencyProperty.Register("RenderFocused", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(false, OnRenderFocusedChanged)); |
|||
public bool RenderFocused |
|||
{ |
|||
get { return (bool)GetValue(RenderFocusedProperty); } |
|||
set { SetValue(RenderFocusedProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderFocusedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderFocusedChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderFocusedChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderFocused
|
|||
|
|||
#region RenderMouseOver
|
|||
|
|||
public static readonly DependencyProperty RenderMouseOverProperty = DependencyProperty.Register("RenderMouseOver", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(false, OnRenderMouseOverChanged)); |
|||
public bool RenderMouseOver |
|||
{ |
|||
get { return (bool)GetValue(RenderMouseOverProperty); } |
|||
set { SetValue(RenderMouseOverProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderMouseOverChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderMouseOverChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderMouseOverChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderMouseOver
|
|||
|
|||
#region RenderNormal
|
|||
|
|||
public static readonly DependencyProperty RenderNormalProperty = DependencyProperty.Register("RenderNormal", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(true, OnRenderNormalChanged)); |
|||
public bool RenderNormal |
|||
{ |
|||
get { return (bool)GetValue(RenderNormalProperty); } |
|||
set { SetValue(RenderNormalProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderNormalChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderNormalChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderNormalChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderNormal
|
|||
|
|||
#region RenderPressed
|
|||
|
|||
public static readonly DependencyProperty RenderPressedProperty = DependencyProperty.Register("RenderPressed", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(false, OnRenderPressedChanged)); |
|||
public bool RenderPressed |
|||
{ |
|||
get { return (bool)GetValue(RenderPressedProperty); } |
|||
set { SetValue(RenderPressedProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderPressedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderPressedChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderPressedChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderPressed
|
|||
|
|||
#region RenderSelected
|
|||
|
|||
public static readonly DependencyProperty RenderSelectedProperty = DependencyProperty.Register("RenderSelected", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(false, OnRenderSelectedChanged)); |
|||
public bool RenderSelected |
|||
{ |
|||
get { return (bool)GetValue(RenderSelectedProperty); } |
|||
set { SetValue(RenderSelectedProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderSelectedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderSelectedChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderSelectedChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderSelected
|
|||
|
|||
#region RenderHighlighted
|
|||
|
|||
public static readonly DependencyProperty RenderHighlightedProperty = DependencyProperty.Register("RenderHighlighted", typeof(bool), typeof(ButtonChrome), new UIPropertyMetadata(false, OnRenderHighlightedChanged)); |
|||
public bool RenderHighlighted |
|||
{ |
|||
get { return (bool)GetValue(RenderHighlightedProperty); } |
|||
set { SetValue(RenderHighlightedProperty, value); } |
|||
} |
|||
|
|||
private static void OnRenderHighlightedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) |
|||
{ |
|||
ButtonChrome buttonChrome = o as ButtonChrome; |
|||
if (buttonChrome != null) |
|||
buttonChrome.OnRenderHighlightedChanged((bool)e.OldValue, (bool)e.NewValue); |
|||
} |
|||
|
|||
protected virtual void OnRenderHighlightedChanged(bool oldValue, bool newValue) |
|||
{ |
|||
// TODO: Add your property changed side-effects. Descendants can override as well.
|
|||
} |
|||
|
|||
#endregion //RenderHighlighted
|
|||
|
|||
#region Contsructors
|
|||
|
|||
static ButtonChrome() |
|||
{ |
|||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ButtonChrome), new FrameworkPropertyMetadata(typeof(ButtonChrome))); |
|||
} |
|||
|
|||
#endregion //Contsructors
|
|||
} |
|||
} |
|||
Loading…
Reference in new issue