Disabling Backspace Clear

3 posts, 0 answers
  1. Andrew
    Andrew avatar
    104 posts
    Member since:
    May 2008

    Posted 16 Nov 2012 Link to this post

    I'd like to disable the ability of the backspace key to clear my RadComboBox. I have tried doing the following:

    public MyPage()
        this.myCombo.AddHandler(FrameworkElement.KeyDownEvent, new KeyEventHandler(myCombo_KeyDown), true);
    protected void myCombo_KeyDown(object sender, KeyEventArgs e)
        if (e.Key == Key.Back)
            e.Handled = true;

    But this doesn't appear to work due to the fact that myCombo is cleared before my event handler ever fires, and e.Handled is already set to true. 

    Is there any way I can disable the current backspace functionality?

  2. Ventzi
    Ventzi avatar
    114 posts

    Posted 21 Nov 2012 Link to this post

    Hi Andrew,

    Unfortunately there is no way to handle the BackSpace key in Silverlight. The main reason is because you cannot handle the system key events in the TextBox which is a template child of the RadComboBox. 

    In WPF you could handle the PreviewKeyDown event to prevent the backspace.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Paul
    Paul avatar
    113 posts
    Member since:
    May 2009

    Posted 02 May 2013 Link to this post

        The limitation of not being able to disable the backspace key suck but understand why based on what you have said. Anyway a workaround for it is.
    private void cboSite_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
        if (cboSite.SelectedItem == null) {
            if (e.RemovedItems.Count > 0) { cboSite.SelectedItem = e.RemovedItems[0]; }

    This stops the backspace key deleting the current selected item.

Back to Top