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.
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.