@@ -11,6 +11,10 @@ public partial class NumberPicker : IDataErrorInfo
11
11
{
12
12
public static readonly DependencyProperty NumValueProperty =
13
13
DependencyProperty . Register ( "NumValue" , typeof ( int ) , typeof ( NumberPicker ) , new UIPropertyMetadata ( null ) ) ;
14
+ public static readonly DependencyProperty MinNumberProperty =
15
+ DependencyProperty . Register ( "MinNumber" , typeof ( int ) , typeof ( NumberPicker ) , new UIPropertyMetadata ( null ) ) ;
16
+ public static readonly DependencyProperty MaxNumberProperty =
17
+ DependencyProperty . Register ( "MaxNumber" , typeof ( int ) , typeof ( NumberPicker ) , new UIPropertyMetadata ( null ) ) ;
14
18
15
19
public int NumValue
16
20
{
@@ -22,9 +26,29 @@ public int NumValue
22
26
}
23
27
}
24
28
25
- public int MinNumber { get ; set ; } = int . MinValue ;
26
29
27
- public int MaxNumber { get ; set ; } = int . MaxValue ;
30
+ public int MinNumber
31
+ {
32
+ get => ( int ) GetValue ( MinNumberProperty ) ;
33
+ set
34
+ {
35
+ SetValue ( MinNumberProperty , value ) ;
36
+ OnPropertyChanged ( new DependencyPropertyChangedEventArgs ( MinNumberProperty , NumValue - 1 , NumValue ) ) ;
37
+ }
38
+ }
39
+
40
+ public int MaxNumber
41
+ {
42
+ get => ( int ) GetValue ( MaxNumberProperty ) ;
43
+ set
44
+ {
45
+ SetValue ( MaxNumberProperty , value ) ;
46
+ OnPropertyChanged ( new DependencyPropertyChangedEventArgs ( MaxNumberProperty , NumValue - 1 , NumValue ) ) ;
47
+ }
48
+ }
49
+ //public int MinNumber { get; set; } = int.MinValue;
50
+
51
+ //public int MaxNumber { get; set; } = int.MaxValue;
28
52
29
53
public NumberPicker ( )
30
54
{
0 commit comments