9
9
10
10
namespace MaterialWPF . Controls
11
11
{
12
- public partial class Dialog : System . Windows . Controls . ContentControl
12
+ public class Dialog : System . Windows . Controls . ContentControl
13
13
{
14
14
private bool _status = false ;
15
-
15
+
16
16
private Action
17
17
_closeButtonClickAction = null ,
18
18
_actionButtonClickAction = null ;
19
19
20
20
public static readonly DependencyProperty
21
- EnabledProperty = DependencyProperty . Register ( "Enabled" , typeof ( bool ) , typeof ( Controls . Dialog ) , new PropertyMetadata ( false ) ) ,
22
- CloseButtonTextProperty = DependencyProperty . Register ( "CloseButtonText" , typeof ( string ) , typeof ( Controls . Dialog ) , new PropertyMetadata ( "Close" ) ) ,
23
- CloseButtonGlyphProperty = DependencyProperty . Register ( "CloseButtonGlyph" , typeof ( char ) , typeof ( Controls . Dialog ) , new PropertyMetadata ( UI . MiconIcons . Cancel ) ) ,
24
- CloseButtonCommandProperty = DependencyProperty . Register ( "CloseButtonCommand" , typeof ( ICommand ) , typeof ( Controls . Dialog ) , new UIPropertyMetadata ( null ) ) ,
25
- ActionButtonTextProperty = DependencyProperty . Register ( "ActionButtonText" , typeof ( string ) , typeof ( Controls . Dialog ) , new PropertyMetadata ( "Action Button" ) ) ,
26
- ActionButtonGlyphProperty = DependencyProperty . Register ( "ActionButtonGlyph" , typeof ( char ) , typeof ( Controls . Dialog ) , new PropertyMetadata ( UI . MiconIcons . Accept ) ) ,
27
- ActionButtonCommandProperty = DependencyProperty . Register ( "ActionButtonCommand" , typeof ( ICommand ) , typeof ( Controls . Dialog ) , new UIPropertyMetadata ( null ) ) ;
21
+ EnabledProperty = DependencyProperty . Register ( "Enabled" , typeof ( bool ) , typeof ( Controls . Dialog ) ,
22
+ new PropertyMetadata ( false ) ) ,
23
+ CloseButtonTextProperty = DependencyProperty . Register ( "CloseButtonText" , typeof ( string ) ,
24
+ typeof ( Controls . Dialog ) , new PropertyMetadata ( "Close" ) ) ,
25
+ CloseButtonGlyphProperty = DependencyProperty . Register ( "CloseButtonGlyph" , typeof ( char ) ,
26
+ typeof ( Controls . Dialog ) , new PropertyMetadata ( UI . MiconIcons . Cancel ) ) ,
27
+ CloseButtonCommandProperty = DependencyProperty . Register ( "CloseButtonCommand" , typeof ( ICommand ) ,
28
+ typeof ( Controls . Dialog ) , new UIPropertyMetadata ( null ) ) ,
29
+ ActionButtonTextProperty = DependencyProperty . Register ( "ActionButtonText" , typeof ( string ) ,
30
+ typeof ( Controls . Dialog ) , new PropertyMetadata ( "Action Button" ) ) ,
31
+ ActionButtonGlyphProperty = DependencyProperty . Register ( "ActionButtonGlyph" , typeof ( char ) ,
32
+ typeof ( Controls . Dialog ) , new PropertyMetadata ( UI . MiconIcons . Accept ) ) ,
33
+ ActionButtonCommandProperty = DependencyProperty . Register ( "ActionButtonCommand" , typeof ( ICommand ) ,
34
+ typeof ( Controls . Dialog ) , new UIPropertyMetadata ( null ) ) ;
28
35
29
36
public bool ? Enabled
30
37
{
31
- get
32
- {
33
- return this . GetValue ( EnabledProperty ) as bool ? ;
34
- }
38
+ get { return this . GetValue ( EnabledProperty ) as bool ? ; }
35
39
set
36
40
{
37
41
this . SetValue ( EnabledProperty , value ) ;
@@ -51,66 +55,36 @@ public bool? Enabled
51
55
52
56
public string CloseButtonText
53
57
{
54
- get
55
- {
56
- return this . GetValue ( CloseButtonTextProperty ) as string ;
57
- }
58
- set
59
- {
60
- this . SetValue ( CloseButtonTextProperty , value ) ;
61
- }
58
+ get { return this . GetValue ( CloseButtonTextProperty ) as string ; }
59
+ set { this . SetValue ( CloseButtonTextProperty , value ) ; }
62
60
}
63
61
64
62
public char CloseButtonGlyph
65
63
{
66
- get
67
- {
68
- return ( char ) ( this . GetValue ( CloseButtonGlyphProperty ) as char ? ) ;
69
- }
70
- set
71
- {
72
- this . SetValue ( CloseButtonGlyphProperty , value ) ;
73
- }
64
+ get { return ( char ) ( this . GetValue ( CloseButtonGlyphProperty ) as char ? ) ; }
65
+ set { this . SetValue ( CloseButtonGlyphProperty , value ) ; }
74
66
}
75
67
76
68
public string ActionButtonText
77
69
{
78
- get
79
- {
80
- return this . GetValue ( ActionButtonTextProperty ) as string ;
81
- }
82
- set
83
- {
84
- this . SetValue ( ActionButtonTextProperty , value ) ;
85
- }
70
+ get { return this . GetValue ( ActionButtonTextProperty ) as string ; }
71
+ set { this . SetValue ( ActionButtonTextProperty , value ) ; }
86
72
}
87
73
88
74
public char ActionButtonGlyph
89
75
{
90
- get
91
- {
92
- return ( char ) ( this . GetValue ( ActionButtonGlyphProperty ) as char ? ) ;
93
- }
94
- set
95
- {
96
- this . SetValue ( ActionButtonGlyphProperty , value ) ;
97
- }
76
+ get { return ( char ) ( this . GetValue ( ActionButtonGlyphProperty ) as char ? ) ; }
77
+ set { this . SetValue ( ActionButtonGlyphProperty , value ) ; }
98
78
}
99
79
100
80
public Action CloseButtonClick
101
81
{
102
- set
103
- {
104
- this . _closeButtonClickAction = value ;
105
- }
82
+ set { this . _closeButtonClickAction = value ; }
106
83
}
107
84
108
85
public Action ActionButtonClick
109
86
{
110
- set
111
- {
112
- this . _actionButtonClickAction = value ;
113
- }
87
+ set { this . _actionButtonClickAction = value ; }
114
88
}
115
89
116
90
public Dialog ( ) : base ( )
@@ -140,17 +114,6 @@ public void Show()
140
114
if ( this . _status )
141
115
return ;
142
116
143
- /*
144
- DoubleAnimation db = new DoubleAnimation();
145
- db.EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut };
146
- db.To = 0;
147
- db.From = this.ActualHeight;
148
- db.Duration = TimeSpan.FromSeconds(0.5);
149
-
150
-
151
- slideTransform.BeginAnimation(TranslateTransform.YProperty, db);
152
- */
153
-
154
117
this . Visibility = Visibility . Visible ;
155
118
this . _status = true ;
156
119
}
@@ -175,4 +138,4 @@ private void ActionButtonCommandAction()
175
138
this . _actionButtonClickAction ( ) ;
176
139
}
177
140
}
178
- }
141
+ }
0 commit comments