Developing Presentation Layer Surface Applications
The Presentation layer is one of the two development layers of the Microsoft Surface SDK. This layer exposes the same functionality for the general features of Surface as the Core layer, but it is targeted towards a different development model.
The Presentation layer uses Microsoft Windows Presentation Foundation (WPF), which is the standard choice for developing touch-enabled applications because it facilitates many development needs, including custom controls, being touch-enabled by default, and many standard user interface (UI) elements, such as buttons, labels, and scroll bars. With WPF, you can also use custom graphics to create content-rich applications. By building applications with the Presentation layer, you can focus on your application while WPF and pre-built controls handle the common tasks.
The Presentation layer includes a suite of Surface-enabled versions of standard WPF controls. It also supports the use of XAML files for rapid UI development. To minimize how much you have to learn if you have WPF experience, the Presentation layer exposes routed events and attached properties in a way that is consistent with the WPF model for providing you with information about mouse, touch, and stylus input. The Presentation layer also enables a multi-capture system so that one or more touches can be captured by each UI element. For example, on a device made for Surface, up to 50 touches are supported.
By using the Presentation layer, you can create an application UI by using XAML and the Microsoft Expression Blend 4 design software. When you combine the application UI with the corresponding C# code, you can quickly and easily develop touch-enabled applications.
To get started and learn how to create a Surface application that uses the Presentation layer, see WPF Quick Start.
Surface WPF Controls
The Presentation layer of the Surface SDK includes the following touch-enabled WPF controls:
|Surface-specific controls||Components of other controls||Base classes for custom controls|
When to Use the Presentation Layer
Use the Presentation layer when your Surface application does not require high-end graphics, such as complex 3-D animation. Use the Presentation layer when you want to take advantage of built-in Surface controls that enable you to rapidly create a sophisticated application.
Designing by Using Expression Blend 4
Expression Blend is an application that helps you create layout. You export all layout work that you complete in Expression Blend as a XAML file, which is the same file format that WPF-based Surface applications use to define UI. You can access Surface-enabled custom controls in Expression Blend by opening a Surface project that was already created in Microsoft Visual C# 2010 (or Microsoft Visual Studio 2010) using the Surface project templates.
Selecting Surface controls in Expression Blend
To locate and access Surface-enabled custom controls in Expression Blend
In Visual C# 2010 (or Visual Studio 2010), create a Surface project by using the Surface Application (WPF) template, and then save the project.
Open Expression Blend, click the Projects tab, and then click Open Project on the Welcome Screen.
Alternatively, click Open Project/Solution on the File menu.
Navigate to your saved project, select your project's solution file (*.sln), and click Open.
In the Projects panel, open any .xaml file in Design view.
Tip Many tools and toolbars of Expression Blend are enabled only when a .xaml file is opened in Design or Split view. This is because the tools are meant to help you create your application visually on the artboard.
On the toolbar on the left side of the screen, click the double arrows (labeled 1 in the preceding illustration).
The Assets flyout appears.
Tip The Assets flyout can also appear as a panel that can be docked to the user interface of Expression Blend. To open the Assets panel, check Assets in the Window menu. Drag the title bar of the panel to change its docked position.
Surface controls are included in the full list of controls that appear when you click All under Controls. To view only Surface controls, expand Locations, and then click Microsoft.Surface.Presentation.dll (labeled 2 in the preceding illustration).
Select the Surface control that you want to add to your application, and then drag on the artboard to create it.
The changes that you make on the artboard are automatically reflected in the XAML code. For more information about working with Expression Blend, press F1 to open the Expression Blend User Guide, or see Expression Blend 4.
© Microsoft Corporation. All rights reserved.