
Is there a version of Silverlight that works with embedded systems and works with C++ native code ? Survey says yes..
Silverlight for Windows Embedded is a native (C++ based) user interface (UI) development framework for Windows Embedded Compact powered devices and is based on Microsoft Silverlight 3.
Silverlight for Windows Embedded offers a comprehensive C++ API that is fully-compatible with XML-based declarative markup and has no dependency on the .NET Framework.
With Silverlight for Windows Embedded, embedded OEMs can either completely predefine the visual appearance, effects, and behavior in source XAML, or use the C++ programming model to create or customize the UI appearance and functionality for the shell and applications.
Developers can use the Silverlight C++ API to load and display an existing XAML UI, implement event handling for the XAML elements, or customize the UI at run-time by adding new elements or changing the visual appearance to respond to factors present at run-time.
To enable interaction with the XAML UI at run-time, Silverlight for Windows Embedded provides Win32 support for hosting the Silverlight visual tree. It also uses the same visual tree to store new objects added by C++ application code at run time.
Silverlight for Windows Embedded is interoperable with Microsoft Expression Blend 3 and provides tools to generate template application code based on Expression Blend 3 XAML projects.
Silverlight for Windows Embedded provides helper template methods that automate safe implicit-type conversion of generic object types. The Silverlight for Windows Embedded programming model provides a visual host that hosts a Silverlight visual tree in a Win32 window. To handle UI events, you can attach C++ delegates to UI objects through methods available on various classes in the C++ API.
With Silverlight for Windows Embedded, you can create a Silverlight application for an embedded device, create and add custom user controls to your application, add Win32 controls to your application, and support hardware-accelerated graphics in the OS.
Capabilities of Silverlight for Windows Embedded
- Define visual UI for applications in XAML.
- Collaborate with designers by using XAML projects.
- Separate programming logic and UI design.
- Add, modify, and customize the UI at run time.
- Create interactive multimedia UI.
Silverlight is compatible with Silverlight 3 XAML and provides a set of equivalent classes for supported XAML elements.
Silverlight and C++
Silverlight for Windows Embedded, allows you to create a UI that provides advanced visual effects, for your Windows Embedded Compact device shell and applications. Silverlight makes this possible by supporting a subset of Silverlight 3 XAML elements and by supplying a set of C++ classes that provide access to these elements.
Silverlight for Windows Embedded parses XAML UI and loads it into a C++ object tree. Then, it integrates the C++ objects with the Graphics, Windowing, and Events (GWES) subsystem to provide UI for Windows Embedded Compact devices.
Benefits
- Silverlight C++ API and programming model that integrates with the Windows Embedded Compact operating system. This helps shorten the learning curve for developers familiar with programming in C++ for Windows Embedded Compact.
- C++ classes that developers can use to create or customize visual appearance and behavior of UI elements.
- Support for advanced UI features including gradients, transformations, and animations, so that developers can create interactive Silverlight-based controls in UI for embedded applications.
Supported Silverlight UI Features
Advanced Graphics
Graphics capabilities include brushes that produce gradient multicolor blend effects, image brushes that can paint the interior of UI elements, and also transforms, which are used to rotate, scale, translate, or skew UI elements. Three-dimensional (3-D) graphics capabilities include 3-D transforms, which transform UI elements in three-dimensional space.
Layout System
The layout system handles the tasks of drawing, resizing, and positioning UI elements on the graphical window. This removes the responsibility of the developer to draw and size elements on-screen using C++ code. Silverlight supports layout container objects that work with the layout system to intelligently manage the arrangement of UI elements on-screen at run time.
Animation, Timers, and Storyboards
With animation storyboards, UI elements can appear to dynamically change or move on the screen. This is achieved by quickly cycling through a series of images, or key frames, each slightly different from the previous one, over a specified duration of time. This visual effect can be achieved by defining each key-frame C++ object and implementing an animation storyboard.
Pixel Effects
Pixel effects modify the appearance of UI element, for example, by blurring the appearance of an element or adding a drop shadow. Pixel effects usually require hardware acceleration to make the graphics processing done by effects as fast as possible.
Text and Typography
Text controls and typography can both be used to display text in a Silverlight–based application. You can customize the display of text and provide unique customizations by changing visual properties, layout, or applying transforms to the text. With built-in support for the XML Paper Specification (XPS), you can also use predefined glyphs in the Silverlight UI. A glyph is a rendered image that is a visual representation of a character in a font.
New Controls
Silverlight for Windows Embedded introduces new Silverlight controls to Windows Embedded Compact developers, such as user controls, content controls, grids, canvas, paths, rectangles, and password boxes, which each inherit from the intermediate base class IXRFrameworkElement. Silverlight also provides intermediate base classes specifically intended for creating custom controls.
XAML DESIGNER WORKFLOW
Silverlight for Windows Embedded provides embedded developers and XAML designers with the API and tools for creating advanced UI. With Silverlight, OEMs can use the C++ Silverlight programming model to create UI element, graphics, and animations that leverage blend effects, weights, shadows, and gradients.
OEMs can work closely with XAML designers who use Expression Blend 3 to develop customized device UI for both the shell and applications.
XAML designers can design UI with XAML by using Expression Blend 3, and embedded developers can develop UI functionality in C++ by using Platform Builder.
.

Win32 Control Compatibility
Silverlight for Windows Embedded is compatible with Win32 controls developed in previous versions of Windows CE.
With Win32 control compatibility, you can add window controls, such as the ComboBox, Button, or ListBox, to the Silverlight object tree at run time, without having to rewrite or change the source code for your window controls.
Visual Hosts and Visual Trees
A visual host represents a Silverlight visual tree in a Win32 window. The concept of a visual host is unique to Silverlight for Windows Embedded. Silverlight for Windows Embedded is a framework which uses Win32 and C++ programming, unlike Silverlight 3 which is based on the .NET Framework and uses managed code. All visual elements parsed from XAML are stored in a visual tree, and only one visual tree can belong to one visual host. By loading XAML markup into a visual tree that belongs to a visual host, you can populate the on-screen content for the UI of a Silverlight for Windows Embedded application. Then a Silverlight for Windows Embedded application can search, modify, and add to the XAML elements in the visual tree with C++ code. For more information about visual trees, see Silverlight Object Trees at MSDN.
http://msdn.microsoft.com/en-us/library/cc189034(VS.95).aspx
Host Windows
To access the host Win32 window, first call IXRVisualHost::GetContainerHWND to retrieve an HWND, and then call Windows Embedded Compact Win32 functions that take an HWND as a parameter, such as UpdateWindow, IsChild, or SetParent. Having access to the host's window handle allows you to call Win32 functions directly in Silverlight for Windows Embedded, which is a feature that is not available in Silverlight 3. The visual host provides event handling at run time for objects stored in the Silverlight visual tree.
Handling Events
The way that you use events and delegates in Silverlight for Windows Embedded is different from Silverlight 3 for web applications. In Silverlight for Windows Embedded, you can attach C++ delegates to UI objects through Add*EventHandler methods, in order to handle events.
In contrast, in Silverlight 3 you attach event handlers in XAML attributes or by using the common language runtime (CLR) event model in C#.
Creating Event Handlers
To create an event handler in Silverlight for Windows Embedded, you first define a class that contains all the event handlers for your application, and then define event handlers for the events you want to handle. Once you have implemented an event handler, you can create a delegate, and then attach the delegate to an event of a UI object.
Sample Event Handler in Native C++
(note there is no security or signing in this example that are required):
HRESULT OnMouseEnter(IXRDependencyObject* pSender, XRMouseEventArgs* pArgs)
{
IXRUIElementPtr pUIElement;
bool Captured = false;
if((NULL == pSender) || (NULL == pArgs))
{
hr = E_INVALIDARG;
}
else
{
// Get XRMouseEventArgs.Position from the event data and
// add code for additional position processing
XRPoint Position = pArgs->Position;
// Get the object sender and call IXRUIElement::CaptureMouse
pSender->QueryInterface(IID_IXRUIElement, &pUIElement);
pUIElement->CaptureMouse(&Captured);
hr = S_OK;
}
return hr;
}
Retrieving event data
An event handler must accept an XREventArgs derived structure that contains event data. Silverlight for Windows Embedded provides a variety of such event structures that contain data for specific types of events. As long as it reflects the appropriate event type, you can use any XREventArgs-derived structure in the method signature for your custom event handler. Then, you can extract data from the structure to determine information about the event. For example, XRMouseEventArgs provides a Position member that describes the x-coordinate and y-coordinate for the position on the screen where the mouse event occurred.
Modifying Other UI Elements in Event Handling Code
An event handler takes two input parameters: the object sender and an event data structure. To access or modify an object in the visual tree other than the object sender, you need a pointer to the visual host. To access the visual host in event-handling code, you can create a SetHost custom method in your event class that sets the pointer to the visual host to a variable in the event class. Then, you can use that variable to access the visual host in any event handlers in your class.
Add an Event Handler to Parsed XAML Elements
In Silverlight for Windows Embedded, you cannot add names of C# event handlers to XAML elements by using event handler syntax for an attribute of the element.
Instead, you must find each named element at run time and add event handlers to them by using the Add*EventHandler methods. To do this, you must retrieve an object pointer to each named element from the visual tree. For more information about the visual tree, see "Working with Visual Hosts and Visual Trees in Silverlight for Windows Embedded" earlier in this cookbook.
For a list of Add*EventHandler methods available in each object, see the Silverlight for Windows Embedded reference documentation for that object.
X:NAME
You must know the x:Name values for each element that raises events to add an event handler to a parsed element. The x:Name values are defined in the source XAML file.
Recommended Device Specifications for Silverlight for Windows Embedded

Hardware Guidelines
- ARM V6 with Vector Floating Point Unit (VFPU)
- 550 megahertz (MHz) processor
- 256 MB RAM
- 2-D or 3-D Graphics Processing Unit (GPU) with a DirectDraw or an OpenGL interface
For DirectDraw
- a GPU or video hardware
- Per-pixel and constant alpha blits
- Premultiplied alpha blits
- Hardware-accelerated alpha blits
- Hardware-accelerated blits on raster operations that use raster-operation code SRCCOPY between system-video and video memory
- Hardware-accelerated stretch blits for raster operations that use raster-operation code SRCCOPY
- Hardware-accelerated color fill
- 20 MB video memory (or system memory that a GPU can directly operate)
For OpenGL
- you have an OpenGL driver that supports the OpenGL Embedded Systems (ES) 2.0 specification
- It should pass the Khronos conformance tests. For more information, see the Khronos Group Web site.
- Additionally it should support a simple vertex and fragment shader that matches the platform's GPU and is linked to a file named Shaders.dll.
- Support run-time compilation of the default shader source code in Windows Embedded Compact.
More to follow in Future Posts..