I use VS2010, C# to develop Silverlight 4 app, I use following code in my XAML file:
<Canvas x:Name="Scene" FlowDirection="LeftToRight" Background="White" KeyDown="Scene_KeyDown" MouseMove="Scene_MouseMove">
and this is my XAML.cs file, I want to display a message box if any key is pressed (it is for test only):
private void Scene_KeyDown(object sender, KeyEventArgs e)
{
MessageBox.Show("1");
}
but nothing is displayed after keys are pressed! what is going wrong? should I set any property? command? tabstop? keypreview?
please help me
Looks like this answer will solve your problem: