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

Overriding the Key Up and Key down events in RadComboBox

6 Answers 144 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sajeev
Top achievements
Rank 1
Sajeev asked on 05 Aug 2011, 01:27 PM
Hi,

Have a requirement where the combobox should behave differently to Key up and Key down events when in dropdown open and dropdown closed modes.

I need when the dropdown is closed and the text is focused, the key up and key down event should not move to next item in the drop down list, instead just post an event which will be used by another module. In case of when the dropdown is in opened state, the key up/key down should move on the items on the list.

Am using MVVM pattern, but catching the key events in code behind.

Is this possible???

Sajeev

6 Answers, 1 is accepted

Sort by
0
Sajeev
Top achievements
Rank 1
answered on 06 Aug 2011, 08:43 AM
Possibly can be achieved using Triggers. Need to check.
0
Jason
Top achievements
Rank 1
answered on 11 Aug 2011, 03:37 PM
I have the same need.  I need to disable the default handling of Up and Down so that it doesnt move the item and another piece can know when up and down are hit.  But if the dropdown is open i want up and down to maintain their current ability.

I decompiled the code and it looks like all of the key handling methods are private or protected internal virtual and the handler is added via AddHandler with true as the last parameter to always process no matter what.

Therefore i cannot see a way to override the default processing of keys but this is a feature that we really need.
0
Valeri Hristov
Telerik team
answered on 15 Aug 2011, 11:50 AM
Hello,

You could override the virtual protected internal method HandleKeyDown and call base when the key is not Up/Down.

Greetings,
Valeri Hristov
the Telerik team

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

0
Jason
Top achievements
Rank 1
answered on 15 Aug 2011, 12:52 PM
internal means it can only be seen from the same assembly, so no we cannot override that method.  If the internal keyword were not there and it was just protected then yes we could do what we need to
0
Valeri Hristov
Telerik team
answered on 15 Aug 2011, 12:57 PM
internal protected means internal OR protected, e.g. public in the same assembly, protected in the other assemblies:
http://msdn.microsoft.com/en-us/library/ms173121.aspx

It works, believe me :)

Greetings,
Valeri Hristov
the Telerik team

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

0
Jason
Top achievements
Rank 1
answered on 15 Aug 2011, 01:05 PM
oh cool, having never used protected internal before and assuming what it meant i thought you would only be able to override from class in the same assembly.  cool this will work then

Thanks
Tags
ComboBox
Asked by
Sajeev
Top achievements
Rank 1
Answers by
Sajeev
Top achievements
Rank 1
Jason
Top achievements
Rank 1
Valeri Hristov
Telerik team
Share this question
or