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

Dash on Number keypad doesn't work RadMaskedTextInput

5 Answers 204 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
danparker276
Top achievements
Rank 2
danparker276 asked on 08 Mar 2013, 01:13 AM
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>

5 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 12 Mar 2013, 04:26 PM
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.

0
danparker276
Top achievements
Rank 2
answered on 12 Mar 2013, 05:02 PM
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.
0
Tina Stancheva
Telerik team
answered on 15 Mar 2013, 02:59 PM
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.

0
Jeff
Top achievements
Rank 1
answered on 17 Apr 2014, 05:05 PM
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.
0
Pavel R. Pavlov
Telerik team
answered on 22 Apr 2014, 08:57 AM
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.

 
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
danparker276
Top achievements
Rank 2
Answers by
Tina Stancheva
Telerik team
danparker276
Top achievements
Rank 2
Jeff
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or