views:

289

answers:

1

Hi,

I have TextBox which allows the user to enter a query and a datagrid below with live results. I want to redirect Down/Up/PageDown/PageUp keys from TextBox (which is focused) to the DataGrid with results. I don't have a problem with intercepting KeyDown/KeyUp evens from TextBox but don't know how to "inject" them into DataGrid.

What would be the simplest way to do this (without manually controlling a selected DataGrid row, reinventing PageDown/Up behavior or scrolling selection into view)?

Many thanks,

Karol

A: 

Why are you usig a textbox at all then? If you redirect the key events to the datagrid, why do you bother with having the textbox in the first place? Surely you can aconplish what you want with the normal databindibg framework provided in silverlight

Alan
I want to have ability to edit a query in TextBox and browse the results at the same time without changing active control. Something like AutoCompleteBox - which is TextBox with dynamically appearing ListBox.
Karol Kolenda
I'm still not sure why key events must be redirected. It really sounds like you're doing the design wrong. Pressing the 'a' key should add the letter 'a' to the textbox and then inside the keypress handler you should call a method which updates the datagrid based on the current text. The datagrid shouldn't know or care which key has been presed, you should just retrieve the new data and display it.
Alan