RadMaskedCurrencyInput concatenate input values instead of replacement in case of selection and insert (if I switch Keyboard from English to other Language and then insert value with selection)

1 Answer 62 Views
MaskedInput (Numeric, DateTime, Text, Currency)
Waqar
Top achievements
Rank 1
Waqar asked on 18 Aug 2022, 02:50 PM

Hi,

I an using RadMaskedCurrencyInput control for taking number from input its work fine for using English Keyboard. The problem is when I change the system language to Japanese and enter number using NumPad, instead of new value replace with entered one, new value is concatenate with previous value. Like if 415 is already entered, I switch the Keyboard to Japanese  and select the previous entered value and type new number 325, Predication window is open and choose the number 325. After's electing value, our RadMaskedCurrencyInput  shows 325415 value instead of 325.
Please help me to resolve this.


Thanks in Advance.

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 22 Aug 2022, 12:10 PM

Hi Waqar,

Thank you for the provided images.

The reason for this behavior is that when using the Windows Input Method Editor (IME) the SelectionLength of the TextBox responsible for the user input in the RadMaskedCurrencyInput control is set to 0 (by the WPF framework). The input logic of the control then appends the entered text rather than replace it due to this condition.

What I can suggest to achieve the desired result in this particular scenario would be to clear the value of the control in the PreviewTextInput event:

		private void RadMaskedCurrencyInput_PreviewTextInput(object sender, TextCompositionEventArgs e)
		{
			var maskedInput = sender as RadMaskedCurrencyInput;
			if (e.TextComposition is System.Windows.Documents.FrameworkTextComposition)
			{
				maskedInput.Value = null;
			}
		}

Please give this a try and let me know if such an approach would work for you.

Regards, 
Dilyan Traykov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Sajid
Top achievements
Rank 1
commented on 31 Aug 2022, 07:46 AM

Hi Dilyan,
Thanks for answer. This approach always replace text either IME use or not. Can we have some differ approach that all text will be replaced only when we have selection content in RadMaskedCurrenyInput Control?

 

Thanks

Dilyan Traykov
Telerik team
commented on 02 Sep 2022, 12:07 PM

Hi Sajid,

As mentioned in my previous reply, unfortunately, the SelectionLength of the TextBox is set to 0 before the PreviewTextInput event is fired, and at this point, I cannot think of a way to handle this differently.

What I can suggest would be to forward this inquiry to the MSDN or StackOverflow forums to see if anyone has any ideas on how to detect the IME input with a previous selection. Please let me know how this goes.

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Waqar
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or