måndag 26 januari 2009

Surface SDK's WPF layer

To quickly get around with developing for Microsoft Surface, and understanding how cool multi-touch applications are, the WPF layer is a good starting point. The WPF layer API of the Surface SDK extends Windows Presentation Foundation to be used in touch-enabled user interfaces. WPF layer controls are standard WPF controls, but Microsoft Surface enabled.

The WPF layer is actually really easy to get started with. XAML is used to declaratively define the user interface. Also, many of the controls one is familiar with from WPF also exist for Microsoft Surface, only now prefixed by ‘Surface’. The XAML examples below show two versions of a window with the same functionality, one traditional WPF and the other is Surface.

Standard WPF:

Surface SDK:

Note: Normally ‘Click’ is not a contact event, but for SurfaceButton it is. This is worth keeping in mind for later when you start using ContactDown for other controls.

As you can see there is not much that differs the two windows. This makes it very easy to transition to Microsoft Surface development and rapidly create touch-enabled applications. Use these mnemonic rules to get started:
  • A Surface control is usually named the same thing as you’re used to from WPF, but prefixed with ‘Surface’.
  • To add a handler for use interactions, the mouse events are now called contact events.

1 kommentar:

  1. Hi Guys,

    Nice to meet other Surface enthusiasts. thanks for the tip on using windows 7 with Surface ( I'm happy with vista right now but I may switch later).

    Your blog is styled similar to mine, called Mulitouch, which was another pleasant surprise.

    Anyway. You can see my blog at http://theclevermonkey.blogspot.com/. I'm also a Surface developer and a multitouch enthusiast.

    All the best!