Oct 30

Workflow

  • A designer creates a Silverlight-based user interface project in Expression Blend and passes this UI project to a developer. 
  • The developer creates a Windows Embedded application from a Expression Blend project.
  • The developer writes and tests the code that implements the functionality of the application with UI resources from the Expression Blend project.
  • If you wish to allow  the designer and the developer to work on the application in parallel, they create a Designer/Developer contract that defines the interface between the UI and the business logic of the application.
  • If the designer and the developer properly follow this contract, they can assemble the XAML from the Expression Blend project and the C++ files from the developer at any time to view the current state of the application.
  • Embedded Silverlight tools work on the assumption that you and your designer are developing your application according to a Designer/Developer contract, and that there is a clearly-defined interface between the UI and the application implementation.

image

When a designer creates graphics, animations, and user interface elements in Expression Blend, the resulting Expression Blend project contains XAML files that describe the visual components and user interface characteristics of an application. However, these XAML files may include elements that are not supported by Silverlight for Windows Embedded. For each of these XAML files, Expression Blend generates a .NET code-behind file that may contain C# application code. However, since Windows Embedded applications must be written in C++ to use the Windows Embedded native Silverlight runtime, you cannot use these Blend-generated code-behind files as an application template. To use an Expression Blend project as the basis for a Windows Embedded application, you need some way to convert Blend project files to the tools and native runtime of Windows Embedded.


Windows Embedded tools bridges the gap between the Blend project and the Windows Embedded development environment.

  • Verifies incoming XAML files for use with Silverlight for Windows Embedded, locating and reporting any unsupported elements.
  • Automatically generates template application C++ code from XAML source files.
  • Provides a way to easily select objects, hook up events, and add event handlers to your Expression Blend-derived application.
  • Automatically identifies changes in the Expression Blend project and propagates these changes to your application’s project resource files.

If you didn’t have Embedded Silverlight Tools..
Otherwise you would need to manually parse each incoming XAML file to identify and remove unsupported elements. For large Expression Blend projects, this porting task could be a tedious and error-prone process. Since the code-behind files generated by Expression Blend are not suitable for use with Windows Embedded, you would have to manually write your own complex application code to manage the Silverlight runtime and attach event handlers to XAML objects.

When a designer makes changes to the source Expression Blend project, you would have to manually find and merge these changes into your application project. Embedded Silverlight tools merges Expression Blend project updates with a mouse click in the platform builder.

What embedded Silverlight Tools doesn’t do.

• Create XAML files.
• Doesn’t generate managed source code. The tool only generates C++ code for use with Windows Embedded.
• The tool does not support custom controls. You need to manually register any custom controls in your application.
• The tools do not support manual modifications that you make to your Silverlight project outside of Expression Blend.
The tools are not a replacement for Expression Blend, Visual Studio, or Platform Builder; it complements these tools by providing an efficient way to use Expression Blend project files as the basis for Windows Embedded applications. This tool does not offer overlapping functionality that is already available in these other tools.

Common Tasks

  • Generating an application template from an Expression Blend project.
  • Adding event handlers.
  • Updating your application with changes made to the Expression Blend project.

Importing your Blend Project

To create an initial Windows Embedded application template from an Expression Blend project, you use the Platform Builder Subproject Application Wizard. The Subproject Application Wizard generates a Platform Builder subproject from the resources and XAML files of the source Expression Blend project. After you have incorporated the Platform Builder subproject into your Windows Embedded OS design, you can develop, test, and deploy this application as you would any other application.

Guidelines

  • Avoid making manual changes to the Expression Blend XAML files
  • Always edit XAML files from within Expression Blend.
  • If your Expression Blend project contains user controls, ensure that each user control has a unique name, even across namespaces.
  • Verify that your Expression Blend project includes a default App.xaml file for the application class and MainPage.xaml (or Page.xaml) for the startup; do not rename these files.
  • Name all XAML elements that you will attach to event handlers. If you want  to generate empty stub code for your event handlers, you must explicitly name these XAML elements from within Expression Blend.
  • If you want to add XRPack IDs to user controls in your Expression Blend project, add these IDs before you import the project.
  • Finalize the Expression Blend project name and location, XAML file names, the .csproj file name, and all namespace names before you launch the Subproject Application Wizard. Changing the names or locations of any of these files and folders can break build dependencies between your subproject and the Expression Blend project.

Adding Silverlight to your Embedded Project and OS Images

  • Launch Visual Studio.
  • In Platform Builder, open the OS design for your target device. If you do not have a device, you can use Virtual CE PC as your development target.
  • In Platform Builder, open the Catalog Items View for your OS design.
  • Expand Core OS, Windows Embedded Compact, Shell and User Interface, then User Interface.
  • Under User Interface, select the check box for Silverlight for Windows Embedded.
    This enables the Sysgen variable SYSGEN_XAML_RUNTIME in your OS design.
  • Build your OS design.

image

Add the Subproject to Your OS Design
To build and test the application template produced by the Subproject Application Wizard, you must add the generated Platform Builder subproject to your OS design.

image

  • Open your OS design project in Platform Builder.
  • On the Project menu, click Add Existing Subproject.
  • In the new Windows Explorer window, browse to the location of your  project. For example:
    C:\WINCE700\OSDesigns\MyOSDesign\MyProject\MyProject
  • Select the .pbpxml file associated with the MyProject subproject, MyProject.pbpxml. Click Open.
  • Build the Application Template
  • Once you have incorporated this subproject into your OS design, you can compile and link the generated application template to run on your target device.


To build MyProject.exe

  • Select your OS design in Platform Builder. In the Solution Explorer pane, expand Subprojects to view all subprojects.
  • Locate and right-click the MyProject subproject that you created earlier, then click Build.
  • Verify that the output window displays the following message:
    C:\WINCE700\OSDesigns\MyOSDesign\MyProject\MyProject\sources – 0 error(s), 0 warning(s) ======== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ========
  • Run the Application Template
  • When the subproject builds successfully, you can run the resulting application, MyProject.exe, on your target device.

Running the Application

  • To run MyProject.exe on your target device
  • Connect and boot up your device in Platform Builder.
  • On the Target menu, click Run Programs.
  • In the Run Program dialog box, under Available Programs, select MyProject.exe and click Run.
  • Verify that your target device displays the program screen.