Read-only ComboBox : Backspace KeyDown event not triggered

3 posts, 0 answers
  1. develuser
    develuser avatar
    14 posts
    Member since:
    Dec 2011

    Posted 14 May 2012 Link to this post

    Hello Telerik,

    I've created a behavior which essures that the ComboBox stay open when a key is down.

    public class ComboListStaysOpenOnEditBehavior : Behavior<RadComboBox> {
     
        protected override void OnAttached() {
            this.AssociatedObject.KeyDown += new KeyEventHandler( OnKeyDown );
        }
     
        void OnKeyDown( object sender, KeyEventArgs e ) {
            AssociatedObject.IsDropDownOpen = true;
        }
    }

    It works fine, but if the RadComboBox is read-only, the KeyDown event don't trig when the backspace is pressed.
    I use RadControl for Silverlight v 2012.1.430.1050 with Visual Studio 2010 and Silverlight 5.

    Could you please take a look at this problem ?

    Greetings,
    Laurent
  2. Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 18 May 2012 Link to this post

    Hello Laurent,

    The backspace key is handled by the RadComboBox control and that's why the KeyDown event is not fired. I think that the only way to get this working would be to inherit from the RadComboBox and override the OnKeyDown method.
    public class RadComboBoxExtended : RadComboBox
    {
        protected override void OnKeyDown(KeyEventArgs e)
        {
            this.IsDropDownOpen = true;
            base.OnKeyDown(e);
        }
    }

    All the best,
    Ivo
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. develuser
    develuser avatar
    14 posts
    Member since:
    Dec 2011

    Posted 21 May 2012 Link to this post

    Hello Ivo,

    Thank you very much,

    Laurent
Back to Top