Text is no longer left-aligned when editing in RadMaskedNumberInput

5 posts, 1 answers
  1. Jordan
    Jordan avatar
    12 posts
    Member since:
    Jul 2012

    Posted 03 Aug 2012 Link to this post

    Here's my xaml:

    <telerik:RadMaskedNumericInput HorizontalAlignment="Stretch" Grid.Row="3" Grid.Column="1" Value="{Binding Port}"
                                   IsClearButtonVisible="False" IsEnabled="{Binding IsReady}" Margin="0,5,0,0" Mask="d5"
                                   AutoFillNumberGroupSeparators="False" AllowSkipPlaceholders="False" HorizontalContentAlignment="Left"
                                   SelectionOnFocus="CaretToBeginning" Placeholder=" " AutoFillZeros="False" TextMode="PlainText"
                                   InputBehavior="Insert"/>

    This is a simple text field for a TCP/IP port. It should have 5 digits. When the input field is not in focus and the port is only 4 digits (e.g. 8000) the text is left-aligned. When the input field is in focus and being edited, it places what I believe is a placeholder for the empty left-most digit. It really should just leave it as a left-aligned 4-digit number. This is truly annoying.

    In general, this control is horribly complicated and could be made simpler by making much of the above xaml the default values.
  2. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 08 Aug 2012 Link to this post

    Hello Jordan,

    Thank you for writing to us and sharing your experience with the RadMaskedNumericInput control. I can see your point regarding the control's implementation, but please have in mind that we're trying to provide a common functionality of all MaskedInput controls so that they can be used in a large variety of scenarios. We have defined the default values of the MaskedNumericInput properties based on the most common scenarios in which the control is used by our customers. However, we will definitely take your feedback into consideration and if we see that many customers find it hard to work with the default setup of the control, we'll make sure to update it accordingly.

    In the meantime, let me get back to the issue at hand. You are absolutely right that once you enter the edit mode of the MaskedNumericInput, it displays the placeholder of the empty position and as the applied Mask requires an input of 5 digits, you can't remove the placeholder. However, with the Q2 2012 release we introduced a new feature in the control that allows you to specify an empty Mask. This way the control doesn't apply any restrictions on the entered input (apart from the fact that it requires numeric values). And in your case this can help as the control won't display any placeholders because it won't expect a specified number of digits. And as you need to create a control for entering TCP/IP ports, you can apply a restriction to the maximum value of the control and make sure the users won't be allowed to enter an invalid input.

    For example you can change your MaskedNumericInput definition to the following:
    <!--  NoMask functionality  -->
    <telerik:RadMaskedNumericInput
            xmlns:input="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"
            Margin="0,5,0,0"
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            HorizontalContentAlignment="Left"
            AllowSkipPlaceholders="False"
            AutoFillNumberGroupSeparators="False"
            AutoFillZeros="False"
            input:MaskedInputExtensions.Maximum="99999"
            InputBehavior="Insert"
            IsClearButtonVisible="False"
            IsEnabled="{Binding IsReady}"
            Mask=""
            SelectionOnFocus="CaretToBeginning"
            TextMode="PlainText"
            Value="{Binding Port}" />
    Please note
    •  the MaskedInputExtensions.Maximum attached property value (you can change it to better fit your needs) - it applies a restriction on the maximum value that can be entered in the control (read more).
    • the Mask property value - it is empty and this is why it triggers the 'No-Mask' feature of the control.

    I hope this info will help you. Let me know if I can assist you with anything else.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jordan
    Jordan avatar
    12 posts
    Member since:
    Jul 2012

    Posted 09 Aug 2012 Link to this post

    Tina,

    Thanks very much for the reply. I've verified your suggestion works as it should.

    To get back to my other point, you state: "We have defined the default values of the MaskedNumericInput properties based on the most common scenarios in which the control is used by our customers."

    You certainly know your customers more than I do, however, I have trouble believing your statement is correct. The default settings for this control provide for a very uncommon usage, a feeling that I've seen expressed elsewhere on this forum. I am using RadMaskedNumericInput to replace RadMastedTextBox that looked like this:

    <telerik:RadMaskedTextBox Grid.Row="3" Grid.Column="1" MaskedText="{Binding Port}" IsEnabled="{Binding IsReady}" Margin="0,5,0,0" Mask="d" IsTabStop="True" MaskType="Numeric" MaxLength="5" />

    RadMaskedTextBox does, I believe, provide the most common use case; I only needed to set its Mask and MaxLength properties. I think if you switched the default values of IsClearButtonVisible, AutoFillNumberGroupSeparators, AllowSkipPlaceholders, SelectionOnFocus, Placeholder, AutoFillZeros, TextMode, and InputBehavior to what I needed to set manually, I think RadMaskedNumberInput would be far easier to use. But again, I'm basing this off my past and current experience, so perhaps other customers can express their opinion on this forum and help you decide how defaults should be set.

    Thanks again,
    Jordan
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 14 Aug 2012 Link to this post

    Hello Jordan,

    Thank you for sharing your experience. We can definitely track this forum to check on our customers requirements, and if your suggestions gather popularity, we will definitely consider implementing them.

    Thank you again!

    Greetings,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 28 Nov 2013 Link to this post

    The fact that i landed myself in this thread means i concur with Jordan's opinion.
Back to Top
UI for WPF is Visual Studio 2017 Ready