I'm creating the "Hello World" demo app for Microsoft Surface. Here's the 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>
Here's the OnCanvasContactDown handler:
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;
}
The problem is that the event handler never gets called. I'm testing it in Visual Studio 2008. The Surface simulator screen appears and when I click it, I get the visual feedback that I "touched" it, but the label never appears. If I put a breakpoint anywhere within the function, it never breaks.
What am I doing wrong?