Link to home
Start Free TrialLog in
Avatar of richard_exchange
richard_exchangeFlag for Austria

asked on

Silverlight - how to use keyboard with custom control check combobox

Hello,

i have made a custom control which is a combobox with checkboxes as items (multiple selects possible).
How is it possible to use the keyboard (arrow up/down and space) within this custom control.
My control has the base class "control".
Inside it there is the private Combobox with a Templatebinding...

 

The data is bound dynamicaly to the ItemsSource of the combobox via a DependencyProperty and the private list "dataList".

 

All works well but the keyboard does not as expected!?!?!
I want to move with the cursors and select/deselect the checkboxes with the space key.
Please help me!
ASKER CERTIFIED SOLUTION
Avatar of karthika_cts
karthika_cts

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of richard_exchange

ASKER

Hello karthika,

to derive directly from ComboBox class hmm...no i haven't.
I give it a try and come back with results...
Hello karthika,

no, it works the same like my keyhandler (this.CCBox.KeyUp += new KeyEventHandler(CCBox_KeyUp);)...

I think the problem are the checkboxes in the itemslist...
The event does only fire if i select a checkbox, but then the selection bar does not move.
If i click beside the text of the checkbox, the event does not fire but the selection bar moves.
The scrolling of the items does also not work, the bar moves out of the visible area but there is no scrolling...
Finally i have solved my problem.

I have override the keyhandler on the comboboxitem itself.
This way a get the key events i need and can handle it.

Additionally i hade to derive my class from ComboBox   -> Points goes to karthika.

Thanks.