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

Read-only ComboBox : Backspace KeyDown event not triggered

2 Answers 141 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
develuser
Top achievements
Rank 1
develuser asked on 14 May 2012, 12:22 PM
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 Answers, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 18 May 2012, 09:15 AM
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 >>

0
develuser
Top achievements
Rank 1
answered on 21 May 2012, 07:51 AM
Hello Ivo,

Thank you very much,

Laurent
Tags
ComboBox
Asked by
develuser
Top achievements
Rank 1
Answers by
Ivo
Telerik team
develuser
Top achievements
Rank 1
Share this question
or