Can I pass events like key strokes to another control in Silverlight?

Posted by herzmeister der welten on Stack Overflow See other posts from Stack Overflow or by herzmeister der welten
Published on 2010-03-11T18:22:26Z Indexed on 2010/03/11 18:24 UTC
Read the original article Hit count: 229

Filed under:
|
|

Can I pass events like key strokes to another control in Silverlight?

Imagine I'm in a custom control that contains a Textbox and a Treeview.

I'm listening to a Key event for the TextBox. When the user pushes the Arrow Up or Arrow Down key, I want the Treeview to behave as if it's itself who received that event, i.e. it should move the current selection up or down. The user shouldn't lose focus on the TextBox though so that they can continue typing.

Is this possible? I don't want to set the selection manually on the Treeview because it has no easy MoveSelectionUp() or MoveSelectionDown() method, so I would have to duplicate that functionality which is not so trivial especially when the tree is databound and loads nodes on demand.

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about controls