Use routed events with base controls

1 posts, 0 answers
  1. Mattia
    Mattia avatar
    1 posts
    Member since:
    May 2011

    Posted 05 May 2011 Link to this post


    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,

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