mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-12-02 03:47:48 +08:00
fix: NumericUpDown can not input decimal point.
This commit is contained in:
parent
689d5e7a80
commit
d0c14de606
@ -82,6 +82,10 @@ public class NumericUpDown : Control
|
||||
{
|
||||
SetCurrentValue(ValueProperty, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetText(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
@ -116,6 +120,7 @@ public class NumericUpDown : Control
|
||||
if (_textBox.IsFocused && !IsReadOnly)
|
||||
{
|
||||
Value += e.Delta > 0 ? Increment : -Increment;
|
||||
SetText(true);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
@ -164,9 +169,9 @@ public class NumericUpDown : Control
|
||||
});
|
||||
}
|
||||
|
||||
private void SetText()
|
||||
private void SetText(bool force = false)
|
||||
{
|
||||
if (_textBox != null)
|
||||
if (_textBox != null && (!_textBox.IsFocused || force))
|
||||
{
|
||||
_textBox.Text = CurrentText;
|
||||
_textBox.Select(_textBox.Text.Length, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user