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

Use routed events with base controls

0 Answers 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mattia
Top achievements
Rank 1
Mattia asked on 05 May 2011, 11:29 AM
Hello!

I want to know if (and how) I can use the Silverlight routed events provided by Telerik.Windows to extend the base UIElement behaviour. I need that cause I have my own service to drive the key gestures and with that I have to assign a key binding to the Enter and to the Space keys. In WPF I can simply register my 'map methods' to the PreviewKeyDown event, but that doesn't exist in Silverlight so ... if a button or a control has the focus, when I hit the enter button on my keyboard the control hides the correct behaviour (and in the worst scenario hitting Enter executes the wrong command).

Obviously a workaround could be using custom or Telerik controls to override the OnKeyDown base methods and reinvent the wheel, but I prefer to leave that choice as last resort cause using routed events through tunneling can have a lot of benefits. Maybe the solution is simpler than using those events (I'm pretty new to Silverilght world), but those events would be useful for other things.


Thank you for your attention,
MV.

PS: it has been pointed to me that it's not clear. I want the PreviewKeyDown binded to the MainShell

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Mattia
Top achievements
Rank 1
Share this question
or