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

how to apply texttrimming property to masked input

6 Answers 254 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 02 Apr 2015, 05:32 PM
I am looking for a way to apply the texttrimming property to a maskedinput. This property is not directly available at the maskedinput level

6 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 03 Apr 2015, 07:35 AM
Hi Steve,

Keep in mind that the TextTrimming property is applicable only for TextBlock element. If you want to have such functionality in a text input controls (as RadMaskedTextInput or TextBox) you will need to implement it with custom code that trims the text when the focus is lost. You can take a look at the following StackOverflow question that describes such implementation.

As a side note, the controls from the RadMaskedInput suite expose a TextBoxStyle property that accepts a Style which targets TextBox element. You can use this style to customize the TextBox that represents the text in the masked input components. Also you can use the style to apply an approach similar to the one demonstrated in the StackOverflow question.

Regards,
Martin
Telerik
 

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

 
0
Dan
Top achievements
Rank 1
answered on 03 Apr 2015, 01:48 PM

the stackover flow question weblink you provided has nothing to do with a RadMaskInput control.

I can find stack over flow question on common wpf controls all over the internet. I am specifically asking how and if this can be done on a the RadMaskInput control in an easy was an I was hoping for a simple project downloadable source code example.

0
Dan
Top achievements
Rank 1
answered on 03 Apr 2015, 01:50 PM
I saw both a TextBlock and a TextBoxStyle property on the RadMaskInput control. I was hoping the TextBlock property would let me apply texttrimming but the only thing the TextBlock property dealt with was font properties. The TextBoxStyle property does not contain any properties that deal with TextTrimming.
0
Dan
Top achievements
Rank 1
answered on 03 Apr 2015, 06:34 PM

I used the suggestion from the website and applied it to the RadMaskTextInput TextBoxStyle property. But now there is problem of the text being off centered in the RadMaskTextInput control as opposed to a RadMaskTextInput control without the TextBoxStyle being set. That is usually what happened when snippet of code of the web. The snippet may fix one problem but introduced a slew of other problems.

I set the TextBox Style's margin, padding, borderwidth to zero. This solved some of the visual problems that occurs when comparing how the text appears in a RadMaskTextInput  with the TextBoxStyle being set asopposed to one that does not have the TextBoxStyle set.

I attached a picture and a simple program showing the how the text is positioned differently between the two RadMaskTextInput  controls. The control with the TextBoxStyle set positions text all the way to left and higher then the text in a control without a TextBoxStyle set..

 The attached program had to be sent with a jpg extension (WpfAppTextTrimRadMaskTextInput.jpg) After downloading this file change the extension to zip and then unzip the file and then you can access the simple wpf program .

Do you see any fixes that need to be done to the TextBox style so both text are positioned identically in both controls.

0
Dan
Top achievements
Rank 1
answered on 06 Apr 2015, 02:11 PM

Martin that example you provided on the weblink was quite helpful. It took me hours to correct some visual visual problem but that solution you provided let me to allow text wrapping by just setting the property in the style.

Thanks for the help:)

 

0
Pavel R. Pavlov
Telerik team
answered on 07 Apr 2015, 06:55 AM
Hi Steve,

I believe that I already answered all these questions in your other threads. 

Please feel free to contact us again if you encounter any other issues.

Regards,
Pavel R. Pavlov
Telerik
 

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

 
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Dan
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Dan
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or