1 parent
052d6fe2ea
commit
f4d949460a
1 file changed
+18
-9
@@ -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<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)
|
||||
{
|
||||
var ctl = (NumericUpDown)d;
|
||||
@@ -214,8 +219,12 @@ namespace HandyControl.Controls
|
||||
/// </summary>
|
||||
public double Value
|
||||
{
|
||||
get => (double) GetValue(ValueProperty);
|
||||
set => SetValue(ValueProperty, value);
|
||||
get => (double)GetValue(ValueProperty);
|
||||
set
|
||||
{
|
||||
SetValue(ValueProperty, value);
|
||||
SetText();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -430,4 +439,4 @@ namespace HandyControl.Controls
|
||||
return result.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user