Microsoft Surface 用の「Hello World」デモ アプリを作成しています。XAML は次のとおりです。
<s:SurfaceWindow x:Class="HelloWorld.SurfaceWindow1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Title="HelloWorld"
>
<s:SurfaceWindow.Resources>
<ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
</s:SurfaceWindow.Resources>
<Canvas Background="{StaticResource WindowBackground}" s:Contacts.ContactDown="OnCanvasContactDown">
<Label Name="HelloWorldLabel" Visibility="Hidden">Hello, World!</Label>
</Canvas>
</s:SurfaceWindow>
OnCanvasContactDown ハンドラは次のとおりです。
private void OnCanvasContactDown(object sender, ContactEventArgs e)
{
// Get the position of the current contact.
Point contactPosition = e.Contact.GetPosition(this);
// Set the X and Y position of HelloWorldLabel
// in relation to the canvas.
Canvas.SetLeft(HelloWorldLabel, contactPosition.X);
Canvas.SetTop(HelloWorldLabel, contactPosition.Y);
// Make the label visible.
HelloWorldLabel.Visibility = Visibility.Visible;
}
問題は、イベント ハンドラが呼び出されないことです。Visual Studio 2008 でテストしています。Surface シミュレーターの画面が表示され、クリックすると、「触れた」という視覚的なフィードバックが表示されますが、ラベルは表示されません。関数内の任意の場所にブレークポイントを配置しても、壊れることはありません。
私は何を間違っていますか?