@@ -6,8 +6,10 @@ namespace MahApps.Metro.Controls
6
6
public static class ButtonHelper
7
7
{
8
8
public static readonly DependencyProperty PreserveTextCaseProperty =
9
- DependencyProperty . RegisterAttached ( "PreserveTextCase" , typeof ( bool ) , typeof ( ButtonHelper ) , new FrameworkPropertyMetadata ( false ,
10
- FrameworkPropertyMetadataOptions . Inherits | FrameworkPropertyMetadataOptions . AffectsMeasure ) ) ;
9
+ DependencyProperty . RegisterAttached ( "PreserveTextCase" , typeof ( bool ) , typeof ( ButtonHelper ) ,
10
+ new FrameworkPropertyMetadata (
11
+ false ,
12
+ FrameworkPropertyMetadataOptions . Inherits | FrameworkPropertyMetadataOptions . AffectsMeasure ) ) ;
11
13
12
14
/// <summary>
13
15
/// Overrides the text case behavior for certain buttons.
@@ -23,5 +25,31 @@ public static void SetPreserveTextCase(UIElement element, bool value)
23
25
{
24
26
element . SetValue ( PreserveTextCaseProperty , value ) ;
25
27
}
28
+
29
+ /// <summary>
30
+ /// DependencyProperty for <see cref="CornerRadius" /> property.
31
+ /// </summary>
32
+ public static readonly DependencyProperty CornerRadiusProperty
33
+ = DependencyProperty . RegisterAttached ( "CornerRadius" , typeof ( CornerRadius ) , typeof ( ButtonHelper ) ,
34
+ new FrameworkPropertyMetadata (
35
+ new CornerRadius ( ) ,
36
+ FrameworkPropertyMetadataOptions . AffectsMeasure | FrameworkPropertyMetadataOptions . AffectsRender ) ) ;
37
+
38
+ /// <summary>
39
+ /// The CornerRadius property allows users to control the roundness of the button corners independently by
40
+ /// setting a radius value for each corner. Radius values that are too large are scaled so that they
41
+ /// smoothly blend from corner to corner. (Can be used e.g. at MetroButton style)
42
+ /// Description taken from original Microsoft description :-D
43
+ /// </summary>
44
+ [ AttachedPropertyBrowsableForType ( typeof ( Button ) ) ]
45
+ public static CornerRadius GetCornerRadius ( UIElement element )
46
+ {
47
+ return ( CornerRadius ) element . GetValue ( CornerRadiusProperty ) ;
48
+ }
49
+
50
+ public static void SetCornerRadius ( UIElement element , CornerRadius value )
51
+ {
52
+ element . SetValue ( CornerRadiusProperty , value ) ;
53
+ }
26
54
}
27
55
}
0 commit comments