提交 d0c14de6 编写于 作者: N NaBian

fix: NumericUpDown can not input decimal point.

上级 689d5e7a
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册