Skip to content

Value is not updated when user typed new value #36

@tomas-net

Description

@tomas-net

I use NumericUpDown control only with binding to underlaying property Value="{Binding Path=MyProperty, Mode=TwoWay}". I updated library from v2.4.2.2 to v3.0.0.0. It looked like nothing has changed for end-users but there is a major problem.

According to README:

Text portion editing can be:

Cancelled with Escape key or can be
Okay'ed with Enter Key

I thought user CAN confirm new value by pressing Enter key not that user MUST confirm new value. I have this situation, user types new value into NumericUpDown control, green asterisk shows up (value is OK), user goes to another control. New value with green asterisk is still in the previous control but it is NOT UPDATED in underlaying property. User fills some other data, checks everything and clicks save. Due to the fact that new value is not updated I save incorrect data.

This part of code causes the problem and it was introduced with no additional information "why":

// update value typed by the user
if (e.Key == Key.Enter)
{
if (_PART_TextBox != null)
{
if (!IsDataValid)
{
e.Handled = true;
return;
}
Value = FormatText(_PART_TextBox.Text, true);
LastEditingNumericValue = Value;
e.Handled = true;
}
return;
}

Expected behaviour:
User types new value into NumericUpDown control and when loosing focus the new value is updated in underlaying property if it is valid or last valid value is shown and updated if the new value was invalid. Value confirming by pressing enter can be optional (default: FALSE).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions