MaskedTextInput Spacing

10 posts, 1 answers
  1. Xpress
    Xpress avatar
    6 posts
    Member since:
    Jan 2012

    Posted 16 Feb 2012 Link to this post

    Whenever I type into a MaskedTextInput the words have a space.   Whenever the box loses focuses the spaces are truncated and the resultant combined single phrase is left in the box.  Once that box gains the focus again the phrase is broken out into its separate words again.  Is there a to prevent this from happening and have it not truncate the spaces whenever the boxes don't have focus?

    Also, I can't seem to get the boxes character limit past 20 some odd characters.  Is there a way to increase that limit?

    Thanks for any help.
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 21 Feb 2012 Link to this post

    Hi Xpress,

     Setting the Mask to "a40" will enable you to write 40 symbols. We are not sure we understand your first issue. Could you please send us your XAML so that we could investigate it locally and this way be better able to assist you. Thank you in advance.

    Kind regards,
    Petar Mladenov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Xpress
    Xpress avatar
    6 posts
    Member since:
    Jan 2012

    Posted 24 Feb 2012 Link to this post

    This is the code for one of my maskedtextinputs.

    <telerik:RadMaskedTextInput x:Name="rtiPatientAddress1" Width="175"  Margin="2" InputBehavior="Replace" UpdateValueEvent="LostFocus" SelectionOnFocus="SelectAll"
                                Placeholder=" " TextMode="PlainText" >
        <telerik:RadMaskedTextInput.Value>
            <Binding Path="Patient.PatientAddress1" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True" ValidatesOnExceptions="True">
                <Binding.ValidationRules>
                    <local:NameValidation />
                </Binding.ValidationRules>
            </Binding>
        </telerik:RadMaskedTextInput.Value>
    </telerik:RadMaskedTextInput>


    If I were to type the phrase "Address Line 1" into that box it would look fine.  But once that input loses focus the text changes to "AddressLine1"  That is not a behavior I wish to have.  The only solution I can think is to just use a regular text block with validation rules since boxes like these are only validating the existence of text.
  5. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 29 Feb 2012 Link to this post

    Hello Xpress,

     This is expected by design since the MaskedInputControl thinks the Spaces are Placeholders when the TextMode is PlainText. So you can use one of the following scenarios:

    Placeholder=" "
    TextMode="MaskedText"
    or
    Placeholder="_"
    TextMode="PlainText"

    All the best,
    Petar Mladenov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Alan
    Alan avatar
    32 posts
    Member since:
    Jan 2011

    Posted 18 Jul 2012 Link to this post

    I am using 2012.2.607.40 for WPF

    The following XAML seems to have an issue with Select All.
    It does select all for a quick second and then does a deselect.

    Is there a bug?

    <telerik:RadMaskedTextBox  MaskType="None" SelectionOnFocus="SelectAll" />

    To work around I am using:
    <telerik:RadMaskedTextInput  SelectionOnFocus="SelectAll" />
    select all does work! but in this case I do not want the delete symbol when I hover over the control nor do I want the underlines for the input section. How can I remove these?

    Thanks!
    Alan
  7. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 18 Jul 2012 Link to this post

    Hi Alan,

    The RadMaskedTextBox has many known limitations and this is why we usually recommend switching over to the new MaskedInput controls. This is why in your case I believe you've made the right choice. And if you don't want to have a predefined number of characters in the RadMaskedTextInput control, the latest release - Q2 2012 (v. 2012.2.0607) includes a 'no-mask' functionality. This basically means that you can define the RadMaskedTextInput control with a Mask="". This way the user will be able to enter an unlimited number of characters and the control will update its length accordingly to the user input.

    You can also set the IsClearButtonVisible property of the control to False, to hide the ClearButton (read more).

    Greetings,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Alan
    Alan avatar
    32 posts
    Member since:
    Jan 2011

    Posted 18 Jul 2012 Link to this post

    Thank you for the update.

    Double checking invoking WPF XAML telerik:RadMaskedTextInput control with Mask="" does not allow me to enter ANY characters.

    Is there a different value for that Mask property that I should use instead?
  9. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 18 Jul 2012 Link to this post

    Hello Alan,

    Can you tell me the version of the RadControls you're using in your solution - the feature was added with the Q2 2012 release. It doesn't work in the previous versions of the controls.

    I attached a sample solution demonstrating how to use the no-mask functionality in the MaskedTextInput and the MaskedNumericInput controls. Please give the solution a try and let me know if it works for you.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  10. Alan
    Alan avatar
    32 posts
    Member since:
    Jan 2011

    Posted 18 Jul 2012 Link to this post

    I am using the same release as your test project.

    It appears there may be an issue when Mask="" and you also use the property UpdateValueEvent="LostFocus" at the same time.

    When I applied UpdateValueEvent="LostFocus" to your test project it textbox remains locked.
  11. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 19 Jul 2012 Link to this post

    Hello Alan,

    Thank you for getting back to us. You're right, I managed to reproduce the issue with these settings. However, we will need more time to investigate its cause and this is why I logged it in our PITS so that you can track the progress of the task.

    I also updated your Telerik account for bringing this case to our attention.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready