views:

422

answers:

1
+1  A: 

If your PostcodeSearch_KeyDown-method (or anybody else before the textbox in the event-chain, could also be some parent-control in the Preview_KeyDown-Event) sets e.Handled = true (e being the eventArgs), the event will not be propagated to further consumers (as the textbox) and thus no action will occur.

Another reason might be that your WPF-Window is hosted in a WinForms-Application, then you will need to call

ElementHost.EnableModelessKeyboardInterop(YourWindow);

To make keyboard interaction work (google/bing for WPF WinForms InterOp for a full explanation)

Simpzon