
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();
}
}