From: John Mott on
Hi all,

If this isn't the right newsgroup it would be great to get a pointer to the
correct one.

I can't get keyboard events in a trivial WPF application, the keydown event
doesn't seem to be fired. The xaml is

<Grid Keyboard.KeyDown="Grid_KeyDown">
</Grid>

and the handler is

private void Grid_KeyDown(object sender, KeyEventargs e)
{
string s = "set a breakpoint here";
}

when i set a breakpoint on the handler it never fires when I type.

Ideas?

thanks,

john


From: John Mott on
Never mind, i found it. I had searched before but missed it. The 'focusable'
property has to be set on an object (like a canvas) before it will get
keyboard events.


"John Mott" <johnmott59(a)hotmail.com> wrote in message
news:OJjMG5G3IHA.1436(a)TK2MSFTNGP05.phx.gbl...
> Hi all,
>
> If this isn't the right newsgroup it would be great to get a pointer to
> the correct one.
>
> I can't get keyboard events in a trivial WPF application, the keydown
> event doesn't seem to be fired. The xaml is
>
> <Grid Keyboard.KeyDown="Grid_KeyDown">
> </Grid>
>
> and the handler is
>
> private void Grid_KeyDown(object sender, KeyEventargs e)
> {
> string s = "set a breakpoint here";
> }
>
> when i set a breakpoint on the handler it never fires when I type.
>
> Ideas?
>
> thanks,
>
> john
>
>