Disable new line when Enter key is pressed in RadMaskedTextInput

4 posts, 1 answers
  1. Sherwin
    Sherwin avatar
    22 posts
    Member since:
    Jan 2011

    Posted 16 Dec 2014 Link to this post

    Hi,

    Is there a way to disable the creation of new line when Enter key is pressed in RadMaskedTextInput?

    Thanks,
    Sherwin
  2. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 19 Dec 2014 Link to this post

    Hi Sherwin,

    To disable the creation of a new line when you press the Enter key you can set the AcceptsReturn property of the masked input control to False.
    <telerik:RadMaskedTextInput AcceptsReturn="False" />

    I hope this helps.

    Regards,
    Martin
    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.

     
  3. DevCraft banner
  4. Sherwin
    Sherwin avatar
    22 posts
    Member since:
    Jan 2011

    Posted 19 Dec 2014 in reply to Martin Link to this post

    Thanks for the reply. Indeed, setting AcceptsReturn to false will prevent creating new line but it still creates a new line when Ctrl + Enter keys are pressed. We used this key combination as a shortcut in our application. Is there a way to disable this?
  5. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 24 Dec 2014 Link to this post

    Hello Sherwin,

    You can use the KeyDown event handler of the RadMaskedTextInput like so:
    private void RadMaskedTextInput_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
          {
              if (e.Key == Key.Enter && Keyboard.Modifiers == ModifierKeys.Control)
              {
                 e.Handled = true;
              }
          }
    We hope this fits well in your scenario.

    Regards,
    Petar Mladenov
    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