Freigeben über


Breaking Changes Document Errata (Silverlight 3)

This blog post lists additions and corrections to the Silverlight 3 Breaking Changes document.

Like the breaking changes document, I'm splitting the errata into three categories-- Breaking Changes since Silverlight 3 Beta, Breaking Changes since Silverlight 2, and Upgrade Breaking Changes. See Silverlight 3 Breaking Changes document for more information on these categories

Breaking Changes since Silverlight 3 Beta


[Addition] WriteableBitmap Related Section

This section is incomplete. Here is what this section should say:

WriteableBitmap Changes

- The PixelFormat parameter for the WriteableBitmap constructor has been removed. WriteableBitmap(int pixelWidth, int pixelHeight, PixelFormat format) is now WriteableBitmap(int pixelWidth, int pixelHeight).

- The only supported PixelFormat is now Pbgra32.

- Similarly, the PixelFormat and PixelFormats type has been removed.

- The indexer has been replaced with a Pixels[] array.

- WriteableBitmap.Lock() and WriteableBitmap.Unlock() have been removed.

- If you use the Render method. you will need to call Invalidate in order for the bitmap to render.


[Correction] “Effects Files (.ps) can no longer be loaded as Content” Section

In the section called “Effects Files (.ps) can no longer be loaded as Content”, there is a correction in the code example:

pshader = new PixelShader() { UriSource = new Uri("SilverlightCustomEffect;component/GrayScaleEffect.fx.ps", UriKind.Relative) };

Needs a leading “/” (see highlighted below).

pshader = new PixelShader() { UriSource = new Uri(" / SilverlightCustomEffect;component/GrayScaleEffect.fx.ps", UriKind.Relative) };


[Addition] Behavior change to Validator.ValidateObject/TryValidateObject

In Silverlight 3 beta, Validator.[Try]ValidateObject would validate entity-level validation attributes regardless of the success or failure of the property-level validation attributes. Now, Validator.[Try]ValidateObject will only validate entity-level validation attributes if all property-level attributes were validated successfully.

Breaking Changes since Silverlight 2


[Change] 4.1 Should include a link to ASP.NET Server Controls

This section should have had a link to this whitepaper: ASP.NET Server Controls for Silverlight in the Silverlight 3 SDK

Here's a description this whitepaper: "The ASP.NET Server Controls for Silverlight™ (“ASP.NET Silverlight controls”), which are the ASP.NET MediaPlayer and Silverlight controls, have been removed from the Silverlight SDK for Silverlight version 3. This document provides guidance for developers who worked with these ASP.NET controls in previous versions of Silverlight. The information in this document is useful for developers who are moving from the Silverlight 2 SDK to the Silverlight 3 SDK and who either want to upgrade their existing applications or create new applications and are considering using the ASP.NET Silverlight controls."


[Addition] Image.Source now returns null when not initialized
In Silverlight 2, getting Image/ImageBrush.Source before the property was set would create an empty BitmapImage. In Silverlight 3, if the property has not been set, it will return null. For example, if Image.Source has not been set, the following line of code will return null in Silverlight 3:

elementWithImage.Fill.GetValue(ImageBrush.ImageSourceProperty)


[Addition] GetValue(ImageBrush.ImageSource) returns a string instead of a BitmapImage

In Silverlight 2, this code would return a BitmapImage:

myImageBrush.GetValue(ImageBrush.ImageSourceProperty); // returns a string

In Silverlight 3, there is a known bug that this will return a string that is the URI of the bitmap image. Note that calling the property directly (myImageBrush.ImageSource) continues to correctly return the BitmapImage object.


[Addition] <asp:Silverlight> with cross-domain .xap’s has JavaScript error

When using the <asp:Silverlight> control to run a .xap file from a different domain than the ASP.net page, in Silverlight 3 the page will had a JavaScript error when be .xap is loaded. (eg, if the ASP.net page is from foo.com and these app is from bar.com) Other than the yellow icon in the lower left corner of the browser indicating the JavaScript error, the page should continue to work. The underlying problem is that Silverlight 2 did not fire the Loaded event in the case of cross domain .xap’s, this bug was fixed in Silverlight 3 however the <asp:Silverlight> was not expecting Loaded to fire and accessed properties that are not available for cross-domain .xaps.

To fix the JavaScript error, either set HtmlAccess=”Disabled” on the asp:Silverlight control or replace the control with <object> (see “System.Web.Silverlight.dll has been removed from the SDK” for instructions about how to use <object>).

 


[Addition] NotifyCollectionChangedEventHandler.Target returned the ItemsControl, now it returns WeakCollectionChangedEventListener

With Silverlight 2, NotifyCollectionChangedEventHandler.Target returned the ItemsControl, in Silverlight 3 it returns WeakCollectionChangedEventListener.

Upgrade Breaking Changes


[Addition] DataGrid bug where can’t keyboard to last item when HorizontalScrollBarVisibilty=Auto

The DataGrid ScrollIntoView API does not work correctly on the last item if HorizontalScrollBarVisibilty is set to Auto, and there is a horizontal scrollbar present. In this case, the last item will be covered up by the scrollbar. Since the Down key functionality makes use of this API, pressing down to navigate to the last item will also exhibit this behavior. The workaround for this issue is to set HorizontalScrollBarVisibility to Visible for this scenario. Vertical scrolling using the vertical scrollbar is not affected.