This is a migrated thread and some comments may be shown as answers.

Keep Mask inside value

7 Answers 36 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Christophe
Top achievements
Rank 1
Christophe asked on 29 Apr 2015, 06:09 AM

Hi,

 

Sorry if my question has been asked already in this forum.

I'm using a RadMaskedTextInput with a dynamic MASK set in code behind. My current mask is d4Sd3. Therefore, I am expecting 4 digits followed with a capital S and then another 3 digits.

It works well except that in my code behind I would like to get the full content of the input. If I type in 1234567 it displays 1234S567 which is perfect, but then in my code behind I only get 1234567 and the "S" is gone. I need this S to remain in this string. How can I achieve such thing ? This is just an example, it could be any sort of mask.

 

Cheers,

 

Chris

7 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 29 Apr 2015, 06:55 AM
Hello Chris,

The Value in combination with the Placeholder and Mask symbols (such as "S" in the Mask "d4Sd3") is kept in the Text property of the RadMaskedTextInput. However, please keep in mind that this property is designed to work only to retrieve the Text, setting it will do nothing and will not update the Value property.

Text property can return different results depending on the value of the TextMode property.

Regards,
Petar Mladenov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Claire
Top achievements
Rank 1
answered on 19 Apr 2018, 07:06 PM
I have a similar need, and the Text property seemed a solution. But for some reason this property is not updated when the control is inside a DataTemplate.  In that context, the setter of my view model property that is bound to the control's Text property is called only once, when the control is loaded I suppose, but after that it is never updated.
0
Petar Mladenov
Telerik team
answered on 20 Apr 2018, 06:08 AM
Hello Claire,

In R3 2017 we released a ValueMode property of the RadMaskedTextInput allowing masked symbols, placeholders, escaped symbols to be included in the Value property. Could you please check if it works in your scenario, instead of using the Text property ?

RadMaskedTextInput Value Mode

Regards,
Petar Mladenov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Claire
Top achievements
Rank 1
answered on 20 Apr 2018, 12:32 PM

Yes, I had taken a look at that property before posting. Unfortunately, our current version does not include it, our license is expired, and I'm not sure my boss will want to renew it just to fix this particular issue.

I found a workaround by putting the contents of the data template inside a user control, although I'm getting another problem when trying to restore the text box to its original value (we have a Cancel button that lets the user undo any editing). But that's another story.

0
Claire
Top achievements
Rank 1
answered on 20 Apr 2018, 01:28 PM
Setting AllowInvalidValues to True fixed this other issue I mentioned in my previous post. For some reason, the initial value was perceived as invalid by the control.
0
Petar Mladenov
Telerik team
answered on 24 Apr 2018, 04:20 PM
Hi Claire,

Could you please confirm you have solved your scenario ? If no, you can add more code to better illustrate the issue. This way we could check if it is solved in latest version or if an easier workaround is applicable.

Regards,
Petar Mladenov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Claire
Top achievements
Rank 1
answered on 24 Apr 2018, 04:33 PM

Yes, solved using the Text property, with the control inside a UserControl.

Once we renew our license, I will try with the ValueMode property.

Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Christophe
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Claire
Top achievements
Rank 1
Share this question
or