Skip to content

Commit 15671d8

Browse files
committed
Fix bindings.
1 parent 92090a3 commit 15671d8

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

Rubberduck.Core/UI/Controls/NumberPicker.xaml.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ public partial class NumberPicker : IDataErrorInfo
1111
{
1212
public static readonly DependencyProperty NumValueProperty =
1313
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));
1418

1519
public int NumValue
1620
{
@@ -22,9 +26,29 @@ public int NumValue
2226
}
2327
}
2428

25-
public int MinNumber { get; set; } = int.MinValue;
2629

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;
2852

2953
public NumberPicker()
3054
{

0 commit comments

Comments
 (0)