1 parent
052d6fe2ea
commit
f4d949460a
1 file changed
+17
-8
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@@ -178,11 +178,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
var ctl = (NumericUpDown) d;
|
var ctl = (NumericUpDown) d;
|
||||||
var v = (double) e.NewValue;
|
var v = (double) e.NewValue;
|
||||||
if (ctl._updateText && ctl._textBox != null)
|
ctl.SetText();
|
||||||
{
|
|
||||||
ctl._textBox.Text = ctl.CurrentText;
|
|
||||||
ctl._textBox.Select(ctl._textBox.Text.Length, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctl.OnValueChanged(new FunctionEventArgs<double>(ValueChangedEvent, ctl)
|
ctl.OnValueChanged(new FunctionEventArgs<double>(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)
|
private static object CoerceValue(DependencyObject d, object basevalue)
|
||||||
{
|
{
|
||||||
var ctl = (NumericUpDown)d;
|
var ctl = (NumericUpDown)d;
|
||||||
@@ -214,8 +219,12 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double Value
|
public double Value
|
||||||
{
|
{
|
||||||
get => (double) GetValue(ValueProperty);
|
get => (double)GetValue(ValueProperty);
|
||||||
set => SetValue(ValueProperty, value);
|
set
|
||||||
|
{
|
||||||
|
SetValue(ValueProperty, value);
|
||||||
|
SetText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in new issue
Block a user