DoubleEditBox: PropertyChanged doesn't work

Editors for WPF Forum

Posted 13 years ago by Bernhard Wahl
Version: 9.2.0513
Platform: .NET 3.5
Environment: Windows Vista (32-bit)
Avatar
<Editors:DoubleEditBox x:Name="AmountTextBox"
Width="240"
FontSize="14"
VerticalAlignment="Center"
Grid.Column="1"
Minimum="0"
IsNullAllowed="true"
IsNullContentVisible="False"
PromptIndicatorVisibility="Never"
Value="{Binding Path=Amount, Source={StaticResource subsetWindowViewModel}, UpdateSourceTrigger=PropertyChanged}">
</Editors:DoubleEditBox>

The editbox has a binding which should get fired after "PropertyChanged". Now i checked out that i always get a "PropertyChanged" with an old value and after i leave the textbox ("LostFocus") i get the current value set to the Amount property.

I'm working with the newest version (downloaded it today)

Please fix this bug !!!

Comments (7)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Bernhard,

By default, changes made by typing are not immediatlely committed from the part up to the parent PartEditBox. The changes are commited when the part loses focus or the user presses Enter. This behavior can be altered using the PartValueCommitTriggers property.

Sounds like you will want to set it to "All", which includes the StringValueChange (which encompasses typing).


Actipro Software Support

Posted 2 years ago by Procam
Avatar

Hello,

after 11 years this post was created. Is there a solution for the DoubleEditBox to work as TextBox, it means the binding to be raised when setting UpdateSourceTrigger=PropertyChanged ? The reason I use this control is the nice functionality of autocheck for Minimum and Maximum value. I wanted to try the "PartValueCommitTriggers" but where?

Thanks for the answer.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The Editors API was updated in the 2017.1 version when edit boxes were refactored.  In the new API, the editBox.CommitTriggers property can be set to any PartEditBoxCommitTriggers value.  There are All or StringValueChange options in that enum.  The "Edit Box Basics" documentation topic mentions the CommitTriggers property and it affects behavior when values change.


Actipro Software Support

The latest build of this product (v22.1.2) was released 3 months ago, which was before the next post in this thread.
Posted 1 month ago by Procam
Avatar

I am using this from sample (\Actipro Software\WPF-Controls\v21.1.0\SampleBrowser\ProductSamples\EditorsSamples\QuickStart\DoubleEditBoxIntro\MainControl.xaml)

and added the CommitTriggers:


<editors:DoubleEditBox x:Name="editBox" HorizontalAlignment="Center" MinWidth="170" PlaceholderText="Number" CommitTriggers="All"
IsNullAllowed="True" Value="130.5" Minimum="-100000" Maximum="100000" />

When I type a big number (out of the range) and press Enter or Lost focus, then the value is returned to the correct previous. How can I reach this behavior when I type some text (not a number)? It works only when Lost focus but not for pressing Enter. Or even, to display the correct previous in the time I am typing some text?

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

What's happening is if you type in 9999999999999999999999999 while the initial value is 130.5, then it will end up trying to coerce the value to within the Minimum/Maximum range.  Thus it will end up being 100000.  That happens whether it's Enter or LostFocus.

If you type in a completely invalid text value, LostFocus will restore the text version of the last value Value to the embedded TextBox.  Whereas pressing Enter while typing a completely invalid text value, will not change anything, indicating to the end user that the value was not accepted and slightly different typing might be needed to get a valid value, and without wiping out what had been typed so far.  That is by design.

You can press Esc while focus is in the control to restore the previously valid Value back to its text form.


Actipro Software Support

Posted 1 month ago by Procam
Avatar

Ok. I think I will handle this with some local validation.

But anyway, another thing I found, and it happens when using Category editors (e.g. \Actipro Software\WPF-Controls\v21.1.0\SampleBrowser\ProductSamples\GridsSamples\QuickStart\PropertyGridCategoryEditors):

I try to type a negative number in Size or whatever TextBox, DoubleEditBox,.. but it is not possible when using the minus from NumPad. When using TextBox, DoubleEditBox outside of the CategoryEditors works properly. How to handle this?

[Modified 1 month ago]

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

For the other question, we have updated our code for the next maintenance release to prevent the category editor from eating the minus key down event.

In the future, kindly post unrelated questions in a new thread or ticket, as that helps us keep requests organized.  Thanks!


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.