mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-12-02 11:57:37 +08:00
fixed a bug of NumericUpDown
This commit is contained in:
parent
ce94186801
commit
132670dba6
@ -74,7 +74,7 @@ namespace HandyControl.Controls
|
||||
if (_textBox != null)
|
||||
{
|
||||
TextCompositionManager.RemovePreviewTextInputHandler(_textBox, PreviewTextInputHandler);
|
||||
_textBox.TextChanged -= _textBox_TextChanged;
|
||||
_textBox.TextChanged -= TextBox_TextChanged;
|
||||
_textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
|
||||
_textBox.LostFocus -= TextBox_LostFocus;
|
||||
}
|
||||
@ -87,18 +87,22 @@ namespace HandyControl.Controls
|
||||
if (_textBox != null)
|
||||
{
|
||||
TextCompositionManager.AddPreviewTextInputHandler(_textBox, PreviewTextInputHandler);
|
||||
_textBox.TextChanged += _textBox_TextChanged;
|
||||
_textBox.TextChanged += TextBox_TextChanged;
|
||||
_textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
|
||||
_textBox.LostFocus += TextBox_LostFocus;
|
||||
_textBox.Text = CurrentText;
|
||||
}
|
||||
}
|
||||
|
||||
private void _textBox_TextChanged(object sender, TextChangedEventArgs e) => UpdateData();
|
||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e) => UpdateData();
|
||||
|
||||
private void UpdateData()
|
||||
{
|
||||
if (!VerifyData()) return;
|
||||
if (!VerifyData())
|
||||
{
|
||||
_updateText = true;
|
||||
return;
|
||||
}
|
||||
if (double.TryParse(_textBox.Text, out var value))
|
||||
{
|
||||
_updateText = false;
|
||||
|
Loading…
Reference in New Issue
Block a user