This can be reproduced in the Telerik UI for WPF demo application, demo "MASKED INPUT | Numeric Input" -> More Masked Input Examples.
When (very!) quickly following a numeric key press with a press on the enter key, the input field clears itself, causing a discrepancy between the bound ViewModel property (that is correctly updated to the entered value) and the displayed control (which is now empty). For the end result, see the attached Screenshot.
The Tab key does not seem to cause this behavior although it causes the binding to update just like the enter button.
No matter how quickly you press the enter button after entering a value, the control should display the exact value I entered and should never just clear itself.
With best regards
Simon Müller
The display text (the text displayed when the controls is not focused) doesn't match the FormatString on startup of RadMaskedNumericInput. This happens if the FormatString is "00" and the initial value is set to 0. In this case, the initially displayed text is "0", instead of the expected "00". When you focus the masked input control and then lost the focus, the correct display text is shown.
To workaround this, you can override the CoerceDisplayTextOverride method of RadMaskedNumericInput and replace the returned value in case it is "0".
public class CustomMaskedNumericInput : RadMaskedNumericInput
{
protected override string CoerceDisplayTextOverride()
{
var txt = base.CoerceDisplayTextOverride();
if (txt == "\00")
{
txt = "00";
}
return txt;
}
}
This is reproducible with RadMaskedNumericInput and RadMaskedCurrencyInput, when the Mask property is empty.
UpdateValueEvent is LostFocus. FormtString is non default - for example n2 or c2.
When all text is selected and delete key is pressed, the Text will become "$,." or "-." or "($)" - non digit symbols remain in text.
Expected: Text becomes empty string "".
NumericInput or CurrencyInput with value 555666.00.
Select the part '666' press 7. This results is
55|57.00 (caret should be after 7 but is actually shifted to wrong position)
CurrenyInput with Indian Culture. Value is 123456789.
Controls shows: "₹ 1,234,56,789.00"
Expected is : "₹ 12,34,56,789.00"
This reproduces only in a no-mask scenario (Mask="").
For example, if you enter the codes for º and ª, they appears as 'o' and 'a'. In other words, the bigger version of the symbol.RadMaskedCurrencyInput with the following properties:
Mask="#14.2" , FormatString="#,0.##" and IsCurrencySymbolVisible= True
Pressing minus key produces ArgumentException
Message "String cannot be of zero length.\r\nParameter name: oldValue" string
at System.String.ReplaceInternal(String oldValue, String newValue)
at System.String.Replace(String oldValue, String newValue)
at Telerik.Windows.Controls.RadMaskedCurrencyInput.CoerceDisplayTextOverride()
at Telerik.Windows.Controls.RadMaskedInputBase.CoerceDisplayText()
at Telerik.Windows.Controls.RadMaskedInputBase.OnValueInternalChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Telerik.Windows.Controls.RadMaskedCurrencyInput.OnIsNegativeValueChanged()
at Telerik.Windows.Controls.RadMaskedCurrencyInput.set_IsNegativeValue(Boolean value)
at Telerik.Windows.Controls.RadMaskedCurrencyInput.ToggleNegativeSignKey()
For example the following culture: this.currency.Culture = new System.Globalization.CultureInfo("prs-AF"); has this.currency.Culture.NumberFormat {System.Globalization.NumberFormatInfo} CurrencyDecimalDigits: 2 ===> CurrencyDecimalSeparator: "." ===> CurrencyGroupSeparator: "," CurrencyGroupSizes: {int[1]} CurrencyNegativePattern: 3 CurrencyPositivePattern: 0 CurrencySymbol: "؋" DigitSubstitution: NativeNational IsReadOnly: false NaNSymbol: "ناعدد" NativeDigits: {string[10]} NegativeInfinitySymbol: "-∞" NegativeSign: "-" NumberDecimalDigits: 2 ===> NumberDecimalSeparator: "," ===> NumberGroupSeparator: "." NumberGroupSizes: {int[1]} NumberNegativePattern: 3 PerMilleSymbol: "‰" PercentDecimalDigits: 2 PercentDecimalSeparator: "," PercentGroupSeparator: "." PercentGroupSizes: {int[1]} PercentNegativePattern: 1 PercentPositivePattern: 1 PercentSymbol: "%" PositiveInfinitySymbol: "∞" PositiveSign: "+" Typing 12345 in the control produces Value 123 which is wrong. Parsing becomes wrong after the group separator kicks in.
The current workaround is to create a custom control and override the OnTextInput method: public class CustomInput : RadMaskedTextInput { protected override void OnTextInput(TextCompositionEventArgs e) { base.OnTextInput(e); e.Handled = true; } }
RadMaskedInput with NO-MASK (Mask="") and percentage P0 formatstring has some issues with typing digits. After clearing the value and typing digit, caret moves after the percentage sign and editing is not possible.
For example: RadMaskedCurrencyInput with Culture="da-DK" and VALUE 12345.67 and Mask=#9.2. In this culture the currency symbol is "kr." In WIndows 8, the NumberFormat.CurrencyPositivePattern is 2 (meaning '$ n'). In Windows 10, this pattern is 3 (n $). So in WIn8, WIn7 or WIn10 but if you change the pattern programmatically to 2. Th result is: Actual: "kr.___.___._kr,12" this is what we see on load and on focus in control. Editing does not change the value. Desired: 'kr. ___._12.345,67' in pattern 2 Control also produces ugly results with pattern 0 and 1. Control seems to work ok with pattern 3: Actual and Desired: '___._12.345,67 kr.' * this could be achieved on Win 8 with change setting or out of the box in Win10. ============== Workaround (if applicable and desired formatting in the specific scenario) Set in code behind: InitializeComponent(); CultureInfo info = new CultureInfo("da-DK"); info.NumberFormat.CurrencyPositivePattern = 3; this.maskInput.Culture = info;