📜 ⬆️ ⬇️

Differences between Silverlight on Windows and Windows Phone

image This topic describes the implementation differences between Silverlight 3 on Windows and Silverlight on Windows Phone.
I advise you to get acquainted with what supports Silverlight on Windows Phone , as well as to get more detailed information about types and members that are not supported .

Controls
To view the list of supported controls, it is better to read a separate article .

Media
In this case, again I advise you to turn to the original source Media on Mobile Phone .
')
Deep zoom
Silverlight for Windows Phone always uses hardware acceleration in MultiScaleImage , if possible. As a result, any changes to the CacheMode property are ignored.

Delegates
Asynchronous delegates, especially the BeginInvoke and EndInvoke methods , are not supported in the .NET Compact Framework. If you try to call delegates asynchronously, the application will throw a TargetInvocationException instead of a NotSupportedException .

Finalizers
Control Restricted Areas (CER) are not supported in Silverlight for Windows Phone.

Fonts
All fonts that are available go already from ROM. No fonts are installed with Silverlight. It is recommended to use web safe fonts such as Verdana and Segoe. Visual Studio 2010 Express for Windows Phone CTP includes filters that display supported fonts on Windows Phone 7 Series. If you wish to use fonts that are not present on the device, it is recommended to ship them with the application. TrueType fonts are also recommended. Embedded fonts should be added to a DLL or XAP, as embedded resources for runtime support in managed code.

Graphics
Supports graphics, animation, and effects such as Blur and DropShadow . All effects in Silverlight for Windows Phone can use hardware acceleration, therefore you must set the UIElement's CacheMode to BitmapCache .

Own pixel shaders are not supported, hence PixelShader is also not supported. More detailed information about graphics and animation .

Accommodation
All Silverlight applications on Windows Phone are stored on the client device and are not executed inside the browser. All the functionality of Silverlight, which is based on location in the browser - is not available. This includes HTML DOM bridges, the ability to use JavaScript and a link to the plugin object

Input
The controls support various gestures such as touching, pressing, “driving” with your finger. You can handle simple movements: pressing, double pressing, pressing and holding, using mouse events:

You can also use control events to respond to user input. Control events support multi-touch input and can be used to move and scale UIElement objects. In addition, see How to: Handle Manipulation Events .

Isolated Storage
Isolated storage allows an application to store data in a virtual file system. The data is completely fenced off from other system components. This prevents unauthorized access and data corruption by components of another application that stores data.

Isolated storage on Windows Phone does not impose additional quotas on the size limit of storage for Silverlight applications.

The size of the application on Windows Phone can reach up to 2 GB.

The differences between implementation on platforms are as follows:

You can read more about isolated storage in the following articles: Isolated Storage and System.IO.IsolatedStorage

LINQ
LINQ providers for native data sources are not supported in Silverlight for Windows Phone.

Localization
Some types and members that support localization work somewhat differently:

Multisensory and control events
To work with melt-sensory and manipulation events, Silverlight on Windows Phone supports types, members, and events that are not represented in Silverlight 3. For more information, read How to: Handle Manipulation Events

Navigation
Silverlight on Windows Phone provides page navigation models other than Windows. Frame and Page classes are not supported. For more information, see the Frame and Page Navigation topic .

Network
Networking support includes the Windows Communication Foundation (WCF), HttpWebRequest, and WebClient .

Own connections and sockets are not supported. Because ChannelFactory (TChannel) is not supported and you cannot generate proxies dynamically. You must use slsvcutil.exe in the console to generate powers of attorney at the time of compilation.

The Add Service Reference option in Visual Studio also generates proxies that you can connect at compile time. This option is not available in Windows Phone projects in the Community Technology Preview version.

The Style property of the XmlSerializerFormatAttribute class is not supported.

This is not all not supported features, it is written in more detail here .

Performance
Devices have less processor power, storage and memory than desktop computers. They also have limited battery life. You must design applications considering these facts, especially for those applications that use animation and media. Some devices can slow down if you use multiple Storyboard objects or by manipulating a large number of XAML elements.

To optimize XAML code while applying complex transformations, Silverlight on Windows Phone supports CompositeTransform .

Reflection
The implementation of reflection (reflection) is different from the desktop:

Regular expressions
In Silverlight for Windows Phone, the CacheSize property always returns zero, because the implementation of the Regex class does not support caching.

Runtime
Silverlight under Windows Phone 7 Series runs on the .NET Compact Framework.

Security
The difference is with X509 certificates, if you pass an invalid flag when you create an X509Certificate, a NotSupportedException is thrown instead of an ArgumentException .

Sip
To be able to use the software input panel (SIP) for the TextBox control, Silverlight for Windows Phone supports several types and members that are not present in Silverlight 3. For more information, see How to: Specify the SIP Layout in a TextBox.
Silverlight Extensions for Windows Phone .

Silverlight Extensions for Windows Phone
For additional features that are specific to development for Windows Phone, again read the Class Library Reference for Windows Phone . All this functionality is included in Windows Phone Developer Tools.

Text encodings
Encoding.Unicode encoder renamed to System.Text.UnicodeEncoding and UnicodeEncoder.
Encoding.Unicode decoder renamed to System.Text.UnicodeEncoding and UnicodeDecoder

Streams
Unlike Silverlight 3, Silverlight for Windows Phone divides the animation work into two separate streams to improve device performance.
ThreadStaticAttribute is not used in the .NET Compact Framework.

URIs
The HttpUtility class is in the System.Net namespace. On Windows, this class is in the System.Windows.Browser namespace , which is not supported on the Windows Phone platform.

Uri.LocalPath does not convert a slash (/) to a backslash (\). Because URIs for files (file: //) are not allowed. The paths are returned as relative.

The OriginalString property for URI instances truncates spaces before being passed to a URL.

Visual basic
In the .NET Compact Framework, the syntax of LINQ queries in Visual Basic does not support the Select clause, where the statement is optional. If the Select clause does not include parameters that do not change the standard result of the query, you must remove the Select clause.

Visual Basic is not supported in this release.
Visual Basic cannot execute equality check with references of XNamespace and String objects at runtime.

XAML transformations
To optimize XAML when you apply multiple transformations, Silverlight on Windows Phone supports CompositeTransform .

XML
Parsing is not supported due to the fact that the .NET Compact Framework does not support the definition of a document type (DTD). The application throws NotSupportedExeption when it detects a DTD string in XML. To parse a DTD, an application must implement a recognition mechanism or use XML schemas.

Frequently used DTDs are usually run through XmlPreloadedResolver . This type is present in the Silverlight 3 SDK, but is not supported in the Community Technology Preview version.
The following differences are also present:

Other differences
There are a few more limitations in the API:

Exceptions
Some methods throw different exceptions depending on the platform:

Source: https://habr.com/ru/post/88182/


All Articles