Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

Created Unassigned: Decimalupdown can cause unneeded Propertyupdate [21189]

$
0
0
When you use the decimalupdown control with databound entities, the entity becomes changed even if you only quit the decimalupdown field by using the tab- key.

this behaviour is caused by Commitchanges
which calls SyncTextAndValueProperties in the Updownbase file ( see attached file for changes)

Thwo Little changes in the SyncTextAndValueProperties Function fix this behavior ,
if you bind to Value , the decimal Change is really only notified, when there is a real Change:
3,000 > 3 ( value stays in fact the same) is no Change, 3,000> 3,001 is a Change.
...
{
try
{
// Change : if the new value is really a change we set value. SL
T x = this.ConvertTextToValue(text);
if (x.Equals(Value) == false)
Value = this.ConvertTextToValue( text );
}
catch( Exception e )
{
parsedTextIsValid = false;

.....

if( !shouldKeepEmpty )
{
// SL new : Compare the new Textvalue and the current, otherwise we always get changes without real changes
string newValue = ConvertValueToText();
if (newValue.Equals(Text) == false)

Text = ConvertValueToText();
}

// Sync Text and textBox

Viewing all articles
Browse latest Browse all 4964

Trending Articles