There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?

3

Closed

IntegerUpDown: Text property and actual text gets unsynchronized

description

Problem:The text that is displayed in my IntegerUpDown's textbox does not match the Text property of the IntegerUpDown (the Text property of IntegerUpDown.Textbox matches IntegerUpDown.Text) when using the Maximum property.Repro:1. Create an IntegerUpDown
on the page with Maximum set to 1023.2. Run the page, and type in 1024. It changes the value to 1023 automatically.3. Type 4. The text displayed is 10234, but the Text and Value property is 1023.My solution:Modify UpDownBase's SyncTextAndValueProperties method:protected
void SyncTextAndValueProperties(DependencyProperty p, string text){ ... Text = ConvertValueToText(); //my code here if(TextBox != null && TextBox.Text.Equals(Text)) { TextBox.InvalidateProperty(TextBox.TextProperty); } //end of my code#if VS2008 ...}

jenik15, Yes, the Text property will have been reversed to the last valid integer value before the LostFocus event have been raised. This control has been created to input an integer value, and any input that does not resolved as an interger is rejected
and revert to the last valid input.

Could you provide me with more detail on your need to validate an "invalid" text input ?
In the meantime, overriding the "ConvertTextToValue()" method will give you access to this invalid text.