API differences between Surface SDK & Surface Toolkit for Win7

Sep 1, 2010 at 2:51 PM

It would be nice to create a list of differences between the two versions of the surface SDKs (1.0 and 1.5 of the assemblies) and possible workarounds. While porting my surface app to win7 I've already come across a few issues. and I'm sure there are many more.

A proper wiki page would be better than this forum, but I don't know if that's possible on codeplex so I figured I just post the issues I've found so far and then work from there..

Controls in the surface version of the SDK and their Win7 counterparts: (this list assumes you use Blake.NUI's SurfaceTouchDevice to re-route contact events to Win7 touch events)

SurfaceElementMenu - closest match in standard .NET is  the context menu, but it's not touch optimal.

SurfaceUserControl - Use normal UserControl

SurfaceContentControl - Use normal ContentControl

TagVisualizers - No match in the Win7 API

SurfaceTextBox - Use normal text box, but this requires you to manually open the virtual keyboard on the surface device (using the static methods in the Microsoft.Surface.Core.SurfaceKeyboard class)

SurfaceShell and its related functionality (notifications, app orientation etc.) - no match in the Win7 APIs. As these are hardware specific, just put this code in the surface specific project and not in the common assembly.

Differences in APIs:

 - BeginDragDrop returns SurfaceDragCursor instead of a bool. It returns null if drag drop failed.
 - BeginDragDrop on the 1.0 API only accept Cursor or MouseDevice in the list of devices (see issue 11845)

ContactHoldGesture and ContactTapGesture - no equivalent in the current Win7 .NET APIs. Hold can be emulated by starting a dispatcher timer on (Preview)TouchDown and check if the touch is still there when the timer callback is called.

Manipulation and Inertia - The win7 controls have built in support for this - no need to create your own processors. Also, the new .NET 4 processors handle changes in two dimensions (x & y) allowing better natural response to user input.

Anyway, these are the ones I've come across so far.

Sep 1, 2010 at 3:25 PM

Hi Isak,

Thanks so much for you contributions. This is a great start. I've added you as an editor to this project so you should now have access to editing the wiki pages and documentation pages (also wiki based.)

On the ContactHoldGesture and ContactTapGesture - these missing in Surface Toolkit are one reason I made the TapGestureTrigger, which supports both taps and holds.

Please feel free to create a documentation page for this topic and we can add more information there.

Sep 2, 2010 at 3:18 PM
joshb wrote:

Please feel free to create a documentation page for this topic and we can add more information there.

Excellent, thanks Josh. I've started one on http://blakenui.codeplex.com/wikipage?title=APIDifferences

It's not quite ready yet, so I haven't linked it from anywhere but it's a start. Also, I put it under the Home namespace, but we may wanna move it to the Documentation section later

Sep 6, 2010 at 3:50 PM


there is another difference.. the Contact class has a Tag property and the Surface Toolkit has it in the TouchExtensions static class called the SetUserData method...