查看文章 |
silverlight 测试版与正式发布版本的区别
What Changed Between Beta and Release of Silverlight 1.0 This document provides a list of new features, changes, and enhancements that have been made to Silverlight since the Silverlight 1.0 Beta release (MIX release May, 2007). In addition, this document provides a list of "breaking changes" that you might need to make in applications that you created using the Silverlight 1.0 Beta release, in order to make them compatible with the Silverlight 1.0 release. Note: Another resource for breaking changes is here. This overview covers the following topics: New "root" property on Content. Enables access to the root element of the XAML DOM. The following list contains the breaking changes between the release of Silverlight 1.0 and Silverlight 1.0 Beta (Mix release of May, 2007). If you have created applications using the Beta release, please update your applications using this list as a guideline. Use the code samples, where provided, to ensure your application runs on both Beta and RTM version of Silverlight 1.0. The first example shows attaching an event handler in Beta and the second example shows how to do it in the 1.0 release. Silverlight BetaXAML
Remove "Sys." Remove "Sys." from namespaces in your code. For example, change the following beta code. JavaScript
Use the latest Silverlight.js Please make sure you use the latest Silverlight.js provided to you in your applications. A few changes have been made to this file. The plug-in has been renamed from "WPFe Plug-In" to "Silverlight Plug-In". This plug-in is referred to in Silverlight.js file to detect Silverlight on the system. Also the MIME type of the plug-in was changed from application/ag-plugin to application/x-silverlight. Finally, the namespace "Sys." was removed. Make sure all instances of "Sys." are pulled from your applications. Due to difficulties in providing reliable synchronous downloads across all platforms, we’ve removed this feature from our downloader API. Consequently, the 3rd parameter on the download open API has been removed as it is no longer needed. You must update open calls to remove this parameter. Only the Beta release lets you add the extra argument to the downloader open method. Following is an example. JavaScript Glyph element FontURI is Resolved Asynchronously When processing the XAML code, the font specified by the Glyphs FontUri attribute is downloaded separately and asynchronously. This means that text displayed by the Glyphs element will appear once the font is downloaded, in most cases after other content has already appeared. In Silverlight 1.0, there is no event for Glyphs downloading progress when using the FontUri. To work around this you could use the Downloader object to first request the font file (and thus use the Downloader's progress events to know when Glyphs is downloaded). Once the Downloader has finished downloading the font, you can then create a Glyphs element with the FontUri by specifying the exact same URI. Since the font is already downloaded, it would not be downloaded again and the Glyphs element should render almost instantaneously. NOTE: This does make an assumption that the font downloaded will remain in the browser's cache (since this retentive behavior is user and browser specific, this is uncertain) and will be picked up when the Glyphs element attempts to download the same file. In order to reduce surface area, Visibility.Hidden was removed from the product. Prior to this change, Visibility.Hidden behaved the same as Visibility.Collapsed. Since Silverlight behavior is functionally similar to the behavior of WPF Visibility.Collapsed, Visibility.Collapsed was retained. To create content that will work consistently between Beta and 1.0, replace all occurrences of "Hidden" in both XAML and script with "Collapsed." For JavaScript, change this Beta code.JavaScript
Extra check on ASX Tags Resulting in MediaFailed Event There is a set of ASX tags that were ignored in the Silverlight Beta release and that now result in a MediaFailed event. These tags are: PREVIEWMODE, BANNERBAR, PARAM, REPEAT, STARTMARKER, ENDMARKER and some MOREINFO tags. Also, if a REF URL fails to open, Silverlight does not fall back to other REFs in the same ENTRY. Instead, a MediaFailed event is raised. More parser errors are reported in Silverlight 1.0 RTM. Applications will break now in cases where the developer sets a numeric property to an invalid value. In the Beta release, an invalid value was treated as a 0, but Silverlight 1.0 RTM throws an error when it encounters the same value. The following is an example:XAML
We’ve changed OnLoad, OnError, OnResize and OnFullScreenChange to be function-pointer based rather than string based. In order to develop Silverlight content that works on both Beta and 1.0 RTM releases, you need to check the version and develop the application code accordingly. The following is an example using OnResize:XAML Elements in <*.Resource> blocks must be named Elements in <*.Resource> blocks must be named. This means you must have an x:Name property for all content in a <*.Resources> section. For example: Silverlight BetaXAML
The MediaElement Position property value can be greater than the MediaElement NaturalDuration property value This will mostly be seen in broadcast cases which had previously returned 0 for the Position value but now returns the play time. Developers creating transport controls should be aware of this and the need to clip the media if necessary. For example: Silverlight BetaJavaScript
Additional Animation Run-Time Errors Silverlight 1.0 RTM is stricter than Beta in throwing run-time errors caused by functionality that is not supported. Examples of such errors are: This behavior has been changed in order to maintain the cross platform support of Silverlight-based applications. All Web resources should be renamed if they include a "\". For example, use "./assets/images/bg.jpg" instead of ".\assets\images\bg.jpg” This behavior has been changed in order to be consistent across Silverlight and WPF. For example, RTM brush.relativeTransform.toString() will return "Transform" rather than "TransformGroup." The IsFilled property on PathFigure is no longer supported. Developers should remove it from their application code. Silverlight BetaXAML
AddEventListener now Returns a Token to be Passed to removeEventListener to Un-Register Event Handlers If you intend to remove event handlers during the lifetime of your Silverlight-based application, you must change the syntax by which you add the event handlers, and retain a token that is now necessary for the removeEventListener call. The token differentiates for cases where multiple handlers were attached for the same event. If you do not intend to remove event handlers, you can leave your addEventListener calls alone, although you should note that addEventHandler now also supports adding the handlers by reference rather than by a quoted name string. This change was made in order to make the Silverlight event object model more similar to other scripting object model syntaxes. For JavaScript, change this Beta code.JavaScript
Replace <control>.settings.version Property with isVersionSupported Method Use this method to remove the <control>.settings.version property from the object tag and to use a new isVersionSupported method. This method takes a version string (for example, “1.0” or “1.1”) and returns a Boolean indicating whether the plug-in is compatible with the requested version. Following is an example of how to add quotation marks to the value of enableHtmlAccess. Change this example.JavaScript
The width and height properties in createObject must be string values The width and height properties in the createObject function call must be string values, not integer values. Silverlight 1.0 RTM tightens restrictions on which objects can have child objects. For example, Rectangle and TextBlock used could have child objects in Silverlight Beta, but this is no longer allowed. The Downloader object is only able to make a download from the same port as the HTML file that hosts the Silverlight plug-in. |