From f4d949460a684b87d3fb11f35ee8175065dd6d47 Mon Sep 17 00:00:00 2001 From: seedtyx Date: Mon, 8 Jun 2020 14:48:30 +0800 Subject: [PATCH 1/7] fix bug #393 fix bug #393 --- .../Controls/Input/NumericUpDown.cs | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs index 53975dd3..b153a4b2 100644 --- a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs +++ b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; @@ -178,11 +178,7 @@ namespace HandyControl.Controls { var ctl = (NumericUpDown) d; var v = (double) e.NewValue; - if (ctl._updateText && ctl._textBox != null) - { - ctl._textBox.Text = ctl.CurrentText; - ctl._textBox.Select(ctl._textBox.Text.Length, 0); - } + ctl.SetText(); ctl.OnValueChanged(new FunctionEventArgs(ValueChangedEvent, ctl) { @@ -190,6 +186,15 @@ namespace HandyControl.Controls }); } + private void SetText() + { + if (_updateText && _textBox != null) + { + _textBox.Text = CurrentText; + _textBox.Select(_textBox.Text.Length, 0); + } + } + private static object CoerceValue(DependencyObject d, object basevalue) { var ctl = (NumericUpDown)d; @@ -214,8 +219,12 @@ namespace HandyControl.Controls /// public double Value { - get => (double) GetValue(ValueProperty); - set => SetValue(ValueProperty, value); + get => (double)GetValue(ValueProperty); + set + { + SetValue(ValueProperty, value); + SetText(); + } } /// @@ -430,4 +439,4 @@ namespace HandyControl.Controls return result.Data; } } -} \ No newline at end of file +} From c9920ba9514400cebeaff38b2da26e04124c8661 Mon Sep 17 00:00:00 2001 From: seedtyx Date: Mon, 8 Jun 2020 16:04:22 +0800 Subject: [PATCH 2/7] Fix #393 Fix #393 --- .../HandyControl_Shared/Controls/Input/NumericUpDown.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs index b153a4b2..c396ab1f 100644 --- a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs +++ b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs @@ -210,7 +210,7 @@ namespace HandyControl.Controls { ctl.Value = maximum; } - + ctl.SetText(); return num > maximum ? maximum : num; } @@ -220,11 +220,7 @@ namespace HandyControl.Controls public double Value { get => (double)GetValue(ValueProperty); - set - { - SetValue(ValueProperty, value); - SetText(); - } + set => SetValue(ValueProperty, value); } /// From c790b27b014585062a4c8463d63812d1d0c9512e Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 18 Jun 2020 22:25:15 +0800 Subject: [PATCH 3/7] Update build.yml --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f3996a7..a7b99045 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,8 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@master + with: + dotnet_version: '5.0.100-preview.5.20279.10' - name: Build Net_40 run: dotnet build src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj -p:Configuration=Release From f15e631bff0dd7e67138ab7aec290b1c11eea43c Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 18 Jun 2020 22:31:46 +0800 Subject: [PATCH 4/7] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7b99045..d1560efa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@master with: - dotnet_version: '5.0.100-preview.5.20279.10' + dotnet_version: '5.0.100-preview.2.20176.6' - name: Build Net_40 run: dotnet build src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj -p:Configuration=Release From 47197b5caac14d707517c0baea4ce34b76d71fb0 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 18 Jun 2020 22:34:17 +0800 Subject: [PATCH 5/7] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d1560efa..c569d1f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@master with: - dotnet_version: '5.0.100-preview.2.20176.6' + dotnet-version: '5.0.100-preview.5.20279.10' - name: Build Net_40 run: dotnet build src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj -p:Configuration=Release From aba695f6c8bf62e248cf5c1685e154a6cb783fa2 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 18 Jun 2020 22:44:34 +0800 Subject: [PATCH 6/7] Update build.yml --- .github/workflows/build.yml | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c569d1f3..4e48dc70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,22 +24,7 @@ jobs: dotnet-version: '5.0.100-preview.5.20279.10' - name: Build Net_40 - run: dotnet build src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj -p:Configuration=Release + run: dotnet build src/Net_40/HandyControl_Net_40/HandyControl_Net_40.csproj -p:Configuration=Release-Net40 - name: Build Net_45 run: dotnet build src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj -p:Configuration=Release - - - name: Build Net_462 - run: dotnet build src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj -p:Configuration=Release - - - name: Build Net_47 - run: dotnet build src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj -p:Configuration=Release - - - name: Build Net_48 - run: dotnet build src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj -p:Configuration=Release - - - name: Build Core_30 - run: dotnet build src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj --configuration Release - - - name: Build Core_31 - run: dotnet build src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj --configuration Release From cce5fab8b232b67a446a6ef35d3070142a65e4c7 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Thu, 18 Jun 2020 23:07:30 +0800 Subject: [PATCH 7/7] Update NumericUpDown.cs --- .../Controls/Input/NumericUpDown.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs index c396ab1f..429ce518 100644 --- a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs +++ b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs @@ -176,8 +176,8 @@ namespace HandyControl.Controls private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { - var ctl = (NumericUpDown) d; - var v = (double) e.NewValue; + var ctl = (NumericUpDown)d; + var v = (double)e.NewValue; ctl.SetText(); ctl.OnValueChanged(new FunctionEventArgs(ValueChangedEvent, ctl) @@ -247,7 +247,7 @@ namespace HandyControl.Controls /// public double Maximum { - get => (double) GetValue(MaximumProperty); + get => (double)GetValue(MaximumProperty); set => SetValue(MaximumProperty, value); } @@ -275,7 +275,7 @@ namespace HandyControl.Controls /// public double Minimum { - get => (double) GetValue(MinimumProperty); + get => (double)GetValue(MinimumProperty); set => SetValue(MinimumProperty, value); } @@ -290,7 +290,7 @@ namespace HandyControl.Controls /// public double Increment { - get => (double) GetValue(IncrementProperty); + get => (double)GetValue(IncrementProperty); set => SetValue(IncrementProperty, value); } @@ -305,7 +305,7 @@ namespace HandyControl.Controls /// public int? DecimalPlaces { - get => (int?) GetValue(DecimalPlacesProperty); + get => (int?)GetValue(DecimalPlacesProperty); set => SetValue(DecimalPlacesProperty, value); } @@ -320,7 +320,7 @@ namespace HandyControl.Controls /// internal bool ShowUpDownButton { - get => (bool) GetValue(ShowUpDownButtonProperty); + get => (bool)GetValue(ShowUpDownButtonProperty); set => SetValue(ShowUpDownButtonProperty, value); } @@ -332,7 +332,7 @@ namespace HandyControl.Controls public bool IsError { - get => (bool) GetValue(IsErrorProperty); + get => (bool)GetValue(IsErrorProperty); set => SetValue(IsErrorProperty, value); } @@ -344,7 +344,7 @@ namespace HandyControl.Controls public string ErrorStr { - get => (string) GetValue(ErrorStrProperty); + get => (string)GetValue(ErrorStrProperty); set => SetValue(ErrorStrProperty, value); } @@ -359,7 +359,7 @@ namespace HandyControl.Controls public TextType TextType { - get => (TextType) GetValue(TextTypeProperty); + get => (TextType)GetValue(TextTypeProperty); set => SetValue(TextTypeProperty, value); } @@ -371,8 +371,8 @@ namespace HandyControl.Controls public bool ShowClearButton { - get => (bool) GetValue(ShowClearButtonProperty); - set => SetValue(ShowClearButtonProperty, value); + get => (bool)GetValue(ShowClearButtonProperty); + set => SetValue(ShowClearButtonProperty, value); } /// @@ -386,7 +386,7 @@ namespace HandyControl.Controls /// public bool IsReadOnly { - get => (bool) GetValue(IsReadOnlyProperty); + get => (bool)GetValue(IsReadOnlyProperty); set => SetValue(IsReadOnlyProperty, value); }