Dash on Number keypad doesn't work RadMaskedTextInput

6 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 07 Mar 2013 Link to this post

    the regular - next to 0 works on my RadMaskedTextInput, but the one on the number pad doesn't.  Here is my style I'm using:
        <Style x:Key="UpperCodes6Mask" TargetType="telerik:RadMaskedTextInput">
            <Setter Property="FontFamily" Value="Segoe UI" />
            <Setter Property="Margin" Value="0 0 0 0" />
            <Setter Property="Width" Value="60" />
            <Setter Property="Height" Value="20" />
            <Setter Property="Padding" Value="0" />
            <Setter Property="Placeholder" Value=" " />
            <Setter Property="IsClearButtonVisible" Value="False" />
            <Setter Property="TextMode" Value="PlainText" />
            <Setter Property="SectionsNavigationMode" Value="None" />
            <Setter Property="IsLastPositionEditable" Value="False" />
            <Setter Property="SelectionOnFocus" Value="SelectAll" />
            <Setter Property="Mask" Value=">a6" />
        </Style>
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 12 Mar 2013 Link to this post

    Hi Dan,

    The minus sign on the NumPad isn't considered as a valid input in a MaskedTextInput control, while the dash key is considered as a valid input in a Mask="aaa". However, you can customize your MaskedTextInput to add a dash in its value when the Substract key is hit by handling the RadMaskedTextInput KedDown event:
    private void RadMaskedTextInput_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.Subtract)
        {
            (sender as RadMaskedTextInput).Value += "-";
            (sender as RadMaskedTextInput).SelectionStart += 1;
        }
    }

    Please give this a try and let me know if it works for you.

    Kind 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. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 12 Mar 2013 Link to this post

    Well why does, '/' , '*' and '+' work on the number pad but not '-'?  That doesn't really make sense.

    Also the above code always puts the - at the end.  If I put the cursor in the middle of some text and hit - it will just append the text.
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 15 Mar 2013 Link to this post

    Hi Dan,

    Thank you for getting back to us. I can see your point on the matter and this is why I logged a new task (making the Substract key a valid input in a MaskedTextInput) in our PITS. You can both vote to increase the priority of the task and track its progress through this link.

    As for my workaround, it adds the "-" at the end as I have implemented a logic that simply extends the value of the control((sender as RadMaskedTextInput).Value += "-"). But you can customize this approach to insert the "-" at the current caret position. Let me know if you have any troubles implementing such an approach.

    Kind regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2009

    Posted 17 Apr 2014 Link to this post

    Apparently this issue got lost in the mix and the PITS link is dead. I've created a new ticket in the new feedback portal though to follow up on this issue.
  7. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 22 Apr 2014 Link to this post

    Hello Jeff,

    Thank you for using our Feedback portal to submit the bug report. I approved it as it was already logged in our PITS system.

    Please follow the submitted item and stay tuned for any changes.

    Regards,
    Pavel R. Pavlov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready