I have this:
<Canvas x:Name="LayoutRoot" KeyDown="LayoutRoot_KeyDown">
</Canvas>
In a newly-minted Ag 3 application in VS2008. I simply changed the default <Grid /> to <Canvas /> and added a KeyDown handler that pops a MessageBox.
But no matter how I tried, the KeyDown event just would never, ever fires.
Is it simply that <Canvas /> doesn’t support KeyDown or am I doing something wrong?
You need to have at least something inside the Canvas that can receive focus, and you will find that the event will bubble up.
You may also want to set
IsHitTestVisible="True"on the Canvas.