Поделиться через


Differences Between Microsoft Silverlight 3 and XAML for Windows Embedded (Compact 2013)

3/28/2014

The following table shows how XAML for Windows Embedded differs from Microsoft Silverlight 3.

Silverlight 3

XAML for Windows Embedded

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 parsing the ControlTemplate XAML element.

Supports parsing and loading a ControlTemplate XAML element, but you cannot access or modify the child elements in the ControlTemplate element by using IXRControlTemplate.

To add new child elements to a user control in Visual C++, use 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 SelectionChanged event of an IXRSelector control, use the IXRSelector::AddSelectionChangedEventHandler.

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, XAML 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.

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.

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

XAML 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 XAML for Windows Embedded classes include methods that work with gesture data, such as IXRUIElement::AddGestureEventHandler.

XAML 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
  • HeaderedItemsControl
  • MediaElement
  • MultiScaleImage
  • Page
  • RichTextBox
  • TabControl
  • TreeView
  • ViewBox
  • WebBrowser
  • WebBrowserBrush

To use a tree view or tab control, create a custom user control. For more information, see XRCustomUserControlImpl<Base,IFace>.

To play audio or video in an application for XAML for Windows Embedded, 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.

XAML 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.

XAML for Windows Embedded does not emulate effects in software.

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 Platform Builder for Windows Embedded Compact 2013, 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 XAML 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 XAML 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 XAML 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 XAML 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 XAML for Windows Embedded application, the effects subsystem uses the following classes to implement the effect.

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 XAML 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.

See Also

Other Resources

XAML for Windows Embedded