Posted
on Oct 12, 2011
(permalink)
Update - I ended up checking ValueChanging to ensure that the event is marked as handled if e.NewValue has the same value as that currently on the actual control.
Thanks for looking.
Hi,
I am using the RadMaskedTextBox to create a new user control. The value of the textbox (let's call this amountMaskedTextBox) is a 2-way binding against a Property (let's call this Amount) which in turn is backed into a DependencyProperty (let's call this AmountProperty).
The UpdateValueEvent of the textbox is set to "PropertyChanged" as I need to check each key entry [made by the user].
The textbox has the following events:
* ValueChanged
* ValueChanging
* GotFocus
* LostFocus
* Loaded
On the Loaded event, I am setting the value of the textbox as the value of Amount formatted as ##,###.## (i.e. amountMaskedTextBox.Value = Amount.ToString("N2");). However, I am finding that this is triggering the ValueChanging and ValueChanged events multiple times which is then replacing my formatted text (e.g. 10,000,000.00) with the raw data (e.g. 10000000).
Any ideas why this is the case?
NB. I am not able to make the MaskType Numeric (with a Mask of n2) as I need to allow users to be able to enter certain special characters.
Thanking you for your assistance,
Tony