Displayed Text Not Updated After Enter Key

Editors for WPF Forum

Posted 12 years ago by Andy Walker
Version: 11.2.0551
Avatar
I'm using the DoubleEditBox (and Int32EditBox) and have noticed that the text not updated after the Enter key is used? The property the control is bound to is updated with the new value, but the text in the control does not update to its correct format until focus is moved from the control. This makes it seem to the user that the Enter key has had no effect.

Is there a way to get the text to update?

Thanks.

Andy.

Comments (4)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Andy,

Is something updating the value/text other than the DoubleEditBox, such as your source property? If so, then it may be the associated Binding that is not pushing back the value to the DoubleEditBox (if the Binding is currently pushing the value from the DoubleEditBox).

If that doesn't help please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

Posted 12 years ago by Andy Walker
Avatar
Hi,

I have sent an example project to support@actiprosoftware.com.

It is Ticket Number: 09D-16B2E05B-030C

Regards,

Andy.

[Modified at 01/25/2012 09:48 AM]
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Andy,

Thank you for the sample. The behavior you are seeing is by design. Since the user is still "editing" the given value, we don't reformat it when they press Enter. Doing so could result in problems with the end-user input. For example, if they typed "54" then Enter, but didn't like the result (whatever that may be) then they could type ".67" and press Enter again to fine tune their entry. If we were to reformat, then they'd have to delete the ".00" added automatically before fine tuning.

We do reformat the text displayed when the focus is lost because then the user is no longer entering a value so we know it's safe.

Either way, you could achieve something similar using the following custom DoubleEditBox, which will select the entire entry when enter is pressed (which results in a reformat also).
public class MyDoubleEditBox : DoubleEditBox {
    static MyDoubleEditBox() {
        PartValueCommitTriggersProperty.OverrideMetadata(typeof(MyDoubleEditBox), new FrameworkPropertyMetadata(PartValueCommitTriggers.SpinnerChange));
    }

    protected override void OnKeyDown(KeyEventArgs e) {
        base.OnKeyDown(e);

        if (!e.Handled && e.Key == Key.Enter)
            this.SelectFirstGroup();
    }
}


Actipro Software Support

Posted 12 years ago by Andy Walker
Avatar
Hi,

Thanks for the explanation and the code snippet.

Regards,

Andy.
The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.