how to apply texttrimming property to masked input

7 posts, 0 answers
  1. Dan
    Dan avatar
    6 posts
    Member since:
    Jan 2015

    Posted 02 Apr 2015 Link to this post

    I am looking for a way to apply the texttrimming property to a maskedinput. This property is not directly available at the maskedinput level
  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 03 Apr 2015 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dan
    Dan avatar
    6 posts
    Member since:
    Jan 2015

    Posted 03 Apr 2015 in reply to Martin Link to this post

    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.

  5. Dan
    Dan avatar
    6 posts
    Member since:
    Jan 2015

    Posted 03 Apr 2015 in reply to Martin Link to this post

    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.
  6. Dan
    Dan avatar
    6 posts
    Member since:
    Jan 2015

    Posted 03 Apr 2015 in reply to Martin Link to this post

    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.

  7. Dan
    Dan avatar
    6 posts
    Member since:
    Jan 2015

    Posted 06 Apr 2015 in reply to Martin Link to this post

    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:)

     

  8. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 07 Apr 2015 Link to this post

    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.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready