What are the differences between Silverlight and Silverlight for Windows Embedded

What are the differences between Silverlight and Silverlight for Windows Embedded

  • Comments 1

Silverlight is a very powerful Web technology that is evolving in different directions: out of the Browser (e.g. Silverlight 4) and also out of the PC (e.g. Windows Phone 7 app platform). Lots of noise happened lately around Silverlight and its future after some public discussions. As you have read all over the Web, Microsoft is definitively NOT pulling the plug on Silverlight, but on the contrary will make it even better and greater to support specific scenarios.

Windows Embedded supports the Silverlight technology in 2 different ways.

  • The first one is the “full” Silverlight support on the Windows Embedded products based on Windows (Windows Embedded Standard, Windows Embedded Enterprise, POSReady). On these products, an OEM or an ISV can leverage the full potential of Silverlight in and out of browser as these embedded OS’ are based on Windows binaries and therefore support Silverlight as is.
  • The second way Windows Embedded benefits from Silverlight technology is on the Embedded operating systems based on Windows CE (Windows Embedded CE/Compact, Windows Embedded Automotive). The Windows Embedded group has developed a native stack to support Silverlight 3 XAML based UIs. I described what is called Silverlight for Windows Embedded in this post where I also provide a simple hello world demo.

The main difference between Silverlight and Silverlight for Windows Embedded is that to develop for Silverlight you use managed code while for Silverlight for Windows Embedded you use C++ code.

Note that Silverlight for Windows Embedded is using Silverlight 3 XAML, so let’s compare what is comparable and see what the differences are between Silverlight 3 and Silverlight for Windows Embedded.

To start with, let’s rapidly talk about the tools:

  • Silverlight 3:  Microsoft Expression Blend is used to edit both XAML and C# and also support project and source code files compatible with Visual Studio so that a developer can work on the same project and source files (XAML and C#).
  • Silverlight for Windows Embedded: Microsoft Expression Blend 3 is used to edit XAML only. C++ code is edited in Visual Studio 2008, while a tool called Windows Embedded Silverlight Tools, will generate C++ code from the XAML source code. You can see how this tool work in this simple hello world demo.

Let’s now dig into more details about the differences:

Silverlight 3

Silverlight for Windows Embedded in Windows Embedded Compact 7

Used for developing interactive applications for the web.

Used for developing user interfaces for shells and applications that run on a Windows Embedded Compact powered device.

Supports code-behind that is written in Visual C# .NET Framework classes, Visual Basic, IronPython, and JavaScript.

Supports code-behind that is written in Visual C++ only.

Hosts the object tree in a plug-in for an Internet browser window.

Hosts the object tree in a visual host that has an underlying Win32 window.

Supports the ControlTemplate XAML element.

Supports parsing and displaying a ControlTemplate, but you cannot access or modify its predefined elements by using Visual C++ code. You can add new elements to a user control in Visual C++ by calling IXRUserControl::SetContent.

Supports event binding directly in XAML through attribute values.

Supports event binding in Visual C++ by attaching event handlers to UI objects.

Event data is stored in classes that inherit from System.EventArgs.

Event data is stored in structures that inherit from XREventArgs, which are used to specify the type of data that is contained in IXRDelegate<ArgType, [SenderType]> objects used to handle specific types of events.

To add event handler methods in code, use the corresponding add and remove public methods. For example, to add an event handler method for the Selected event of an IXRMenuItem control, use the IXRMenuItem::AddSelectedEventHandler.

Supports new events in Silverlight 3.

Not supported.

Raises the GotFocus event when focus is automatically set on the first focusable element in the visual tree during application initialization.

During application initialization, Silverlight for Windows Embedded sets focus to the first focusable element in the visual tree. However, the GotFocus event is not fired in this case unless you explicitly call IXRControl::Focus in the initialization procedure.

Supports double type values.

Supports float type values instead of double type values. The equivalent object of each XAML element that represents a double value actually represents a float and includes "double" in its name only to maintain parity with the name of its equivalent XAML element. For example, see IXRDoubleCollection.

Supports color codes.

Parses color codes from the source XAML markup. You can also define new colors in Visual C++.

Supports the COLORREF type, which can be generated by using the RGB or RGBA macros. These macros accept byte values instead of hexadecimal values.

For more information about identifying the correct BYTE values to use in the RGB or RGBA macro for red, green, and blue, see Web Safe Colors.

Supports data binding, either from a data source to a UI control, or between two UI controls, by using XAML binding declarations that use the following syntax:

<object property="{Binding}" .../>

- or -

   

<object property="{Binding Source=ObjectName

Path=PropertyName}" .../>

Supports data binding from a Visual C++ data source object that implements IXRPropertyBag to a native Visual C++ UI control.

Silverlight for Windows Embedded does not support using a UI control as the data source for another UI control.

Silverlight for Windows Embedded supports only the Path and Mode data binding properties. The Path property is required. You can define XAML binding declarations that use the following syntax:

   

<TextBox Text="{Binding Path=TextPathName,

Mode=OneWay}" />

Supports multi-touch input and the Touch class, which processes multi-touch input.

Does not provide an equivalent Visual C++ class for the Touch Visual C# class for the desktop browser. Use Touch or Touch Gestures instead. Some Silverlight for Windows Embedded classes include methods that work with gesture data, IXRUIElement::AddGestureEventHandler, and IXRMenuItem::GetInputGestureText.

Silverlight for Windows Embedded does not support manipulation events for processing touch input.

Supports the ContentPresenter class, which is derived from FrameworkElement.

Supports the equivalent Visual C++ class IXRContentPresenter, which is derived from the intermediate base class IXRControl instead of from IXRFrameworkElement.

Supports the System.Windows namespace.

Supports XAML elements in the System.Windows namespace and provides many equivalent Visual C++ classes.

The following XAML elements are not supported.

  • AssemblyPart
  • AssemblyPartCollection
  • Deployment
  • Expression

Supports the System.Windows.Controls namespace.

Supports XAML elements in the System.Windows.Controls namespace and provides many equivalent Visual C++ classes. Supports only built-in controls in this namespace, and not extended controls.

Supports VirtualizingStackPanel and ScrollContentPresenter; however, does not support user input from the mouse wheel button and does not provide equivalent Visual C++ methods for the following Visual C# methods.

  • VirtualizingStackPanel.MouseWheelDown
  • VirtualizingStackPanel.MouseWheelLeft
  • VirtualizingStackPanel.MouseWheelRight
  • VirtualizingStackPanel.MouseWheelUp
  • ScrollContentPresenter.LineDown
  • ScrollContentPresenter.LineLeft
  • ScrollContentPresenter.LineRight
  • ScrollContentPresenter.LineUp
  • ScrollContentPresenter.MakeVisible
  • ScrollContentPresenter.PageDown
  • ScrollContentPresenter.PageLeft
  • ScrollContentPresenter.PageRight
  • ScrollContentPresenter.PageUp
  • ScrollContentPresenter.SetHorizontalOffset
  • ScrollContentPresenter.SetVerticalOffset

The following XAML elements are not supported.

  • AutoCompleteBox
  • Calendar
  • DataGrid
  • DataGridCell
  • DataGridCheckBoxColumn
  • DataGridRow
  • DataGridTemplateColumn
  • DataGridTextColumn
  • DataPager
  • DatePicker
  • DescriptionViewer
  • Frame
  • GridSplitter
  • MediaElement
  • MultiScaleImage
  • Page
  • RichTextBox
  • ViewBox
  • WebBrowser
  • WebBrowserBrush

To play audio or video in a Silverlight for Windows Embedded Application, add support for specific media formats to your OS design and add code to play media in the methods of a custom user control. For more information, see Audio, Graphics and Media.

Supports the System.Windows.Controls.Primitives namespace.

Supports XAML elements in the System.Windows.Controls.Primitives namespace and provides many equivalent Visual C++ classes. Supports only built-in controls in this namespace, and not extended controls.

Supports the System.Windows.Documents namespace.

Supports all XAML elements in the System.Windows.Documents namespace and provides many equivalent Visual C++ classes.

Supports the System.Windows.Ink namespace.

Supports all XAML elements in the System.Windows.Ink namespace and provides many equivalent Visual C++ classes.

Supports the System.Windows.Media namespace.

Supports XAML elements in the System.Windows.Media namespace and provides many equivalent Visual C++ classes. The following XAML elements are not supported.

  • DeepZoomImageTileSource
  • VideoBrush

Supports the System.Windows.Media.Animation namespace.

Supports all XAML elements in the System.Windows.Media.Animation namespace and provides many equivalent Visual C++ classes.

Supports the System.Windows.Media.Effects namespace.

Silverlight for Windows Embedded does not implement effects the same way as Microsoft Silverlight 3.

In Microsoft Silverlight 3, the Blur and DropShadow effects are included, and software developers can download OEM-provided custom effects and use them in projects, regardless of the hardware that the Microsoft Silverlight 3 application runs on. The pixel processing performed by those effects happens in software.

Silverlight for Windows Embedded does not emulate effects in software. By default, Blur and DropShadow effects will be ignored by Internet Explorer Embedded.

The Windows Embedded Compact device's board support package (BSP) optionally may provide hardware-accelerated implementations of Blur and DropShadow.

When you create an OS design in Microsoft Platform Builder for Windows Embedded Compact 7, stub code is generated for a Blur and DropShadow effect in the %WINCEROOT%\PUBLIC\common\oak\XamlRuntimeEffects folder. The stub code is provided as a guide for OEM developers. The code also includes an OpenGL Embedded Systems (ES) implementation of the Blur and DropShadow effects called OpenGLBlur and OpenGLDropShadow that works on boards that support OpenGL ES. If your OS design is built for a hardware platform that supports OpenGL ES, you can use the Blur and DropShadow elements in XAML as you normally would in a Microsoft Silverlight 3 application, and the effects will work in your Silverlight for Windows Embedded application. If your OS design is not built for a hardware platform that supports OpenGL ES, the XAML Blur and DropShadow elements will not work unless the OEM developer has added platform-specific code to the stubs. The sample OpenGL ES implementations of Blur and DropShadow serve only as an example, and should not be used without modification in a production device.

An OEM developer can create custom effects that software developers can use in a Silverlight for Windows Embedded application by meeting the following criteria:

  • The device platform supports GPU acceleration, preferably OpenGL ES 2.0. This provides support for programmable vertex and pixel shaders.
  • The device image includes the catalog item for Silverlight for Windows Embedded (SYSGEN_XAML_RUNTIME).
  • The SDK includes a platform-specific version of the XamlRenderPlugin.dll. The XamlRenderPlugin.dll exposes the ICustomGraphicsDevice and related interfaces for creating and composing surfaces in a Silverlight for Windows Embedded application.
  • The SDK includes a platform-specific version of the effect in a library (.dll) file. The effect code must implement the xamlruntimegraphics.h file to create an XAML-supported object that represents the effect, and apply the effect to elements at run time. In a Silverlight for Windows Embedded application, the effects subsystem uses the following classes to implement the effect.
    • IXRCustomEffect
    • XRCustomEffectArguments
    • XRVertex

If properties can be set on the effect, the OEM developer should supply a header (.h) file in the SDK for their effect library file. The Silverlight for Windows Embedded application developer can then include the header file in their application so that they can set those properties in code. The properties of custom effects can also be set in XAML.

Effects may be applied to any UIElement.

An effect may only be applied to a parsed UIElement element that had the CacheMode attribute set to BitmapCache.

An effect may only be applied to an IXRUIElement object after you call IXRUIElement::SetCacheMode.

Supports the System.Windows.Media.Imaging namespace.

Supports all XAML elements in the System.Windows.Media.Imaging namespace and provides many equivalent Visual C++ classes.

Supports the System.Windows.Shapes namespace.

Supports all XAML elements in the System.Windows.Shapes namespace and provides many equivalent Visual C++ classes.

Leave a Comment
  • Please add 7 and 4 and type the answer here:
  • Post
  • Hello,

    I have a problem using ControlTemplates in Silverlight Embedded. I applied a ControlTemplate (declared in XAML and consisting of 2 textboxes) to my IXRUIElementCollection. Now I want to change the texts of these textboxes.

    But I don't know how to access these textboxes?

    Best,

    Max

Page 1 of 1 (1 items)