Export (0) Print
Expand All

Breaking Changes in Silverlight 2

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This topic discusses the changes made to the Silverlight runtime and Silverlight tools between the Microsoft Silverlight 1.1 Alpha September Refresh and the MIX 2008 release. The changes discussed in this article are focused on changes that might cause your older Silverlight-based applications to now fail or behave differently not on new features/enhancements for this release.

  • Important! Migrating Older Code to the Newer Release

  • Update Silverlight.js

  • Template Breaking Changes

  • Error Messages May not be Available

  • 2-D API Changes

  • HttpWebRequest/HttpWebResponse Supports New Functionality

  • PresentationFrameworkCollection<T> Change

  • Mouse and Keyboard API Changes

  • Changes to TextBlock and its Helper Classes

  • XML DTD API Changes and Default XmlResolver

  • XamlReader.Load() Requires xmlns

  • Removal of Managed FontSource (downloader) Signature

  • XmlResolver Changes

  • Assembly Changes

  • Regenerate Web Service Client Proxies

  • WCF JSON Services May Need SOAP Endpoints

  • In Visual Studio, Use "Add Service Reference" Instead of "Add Web Reference"

  • Loaded Event Signature Change

  • Removal of Managed Downloader

  • BrowserHttpWebRequest Removed

  • Removal of managed MediaElement/Image.SetSource(downloader, partName)

  • SetValue Changes

  • Miscellaneous API Changes

  • System.Net.Sockets Namespace Added

If you are migrating Silverlight applications that were created for the Microsoft Silverlight 1.1 Alpha September Refresh or earlier to the Silverlight 2 Beta 1 (MIX 08) release, the following strategy is recommended:

1. Get the newest version of Microsoft Silverlight 2 Tools for Visual Studio 2008. . You can get these tools from the SDK or online at Getting Started. Make sure you uninstall any old tools you have on your machine before doing this install.2. Create a NEW Silverlight application using the new tools from step 1 above.3. Copy all your code/XAML over to your new project.4. Debug. Many of the breaking changes you are likely to encounter can be found in this document.

Note for those working with assembly names/identities - Microsoft assemblies’ identities have been changed in the following regard: - The public key has been changed to a new Microsoft Silverlight key. - The version number (assembly and file version) has been changed to 2.0.You will have to update your assembly name/identity usages accordingly.

The Silverlight.js file has been changed and you will need an updated version for your applications. Older versions of Silverlight.js are not able to ensure the installation of Silverlight 2 Beta 1 for end users who do not already have Silverlight 2 Beta 1 on their computers. If you recompile your Silverlight applications (as mentioned above) the Silverlight.js file will be updated automatically.

These changes are related to Silverlight Visual Studio templates. If you are creating Silverlight applications from Visual Studio, make sure you are using the newest Microsoft Silverlight 2 Tools for Visual Studio 2008. If you do this, you will not have to worry about these changes breaking new projects you create. However, if you have existing applications that you have created using an older version of the VS Silverlight tools, you may have to either recompile your application using the newer tool or make changes to your projects by hand. The changes outlined in this section are for people in the latter situation.

1. SilverlightApplicaton property added. This allows the project system to distinguish between Silverlight applications and Silverlight class libraries.

New

<SilverlightApplication>true</SilverlightApplication>                 - set to false for class library projects

2. The following two properties have been renamed:

Before/After

<ZipOutputs>     has been changed to  <XapOutputs>

<ZipFilename>   has been changed to  <XapFilename>

 

For existing project files, you can hand edit them to make these changes.

Exception messages for mscorlib.dll are no longer shipped with the main Silverlight runtime. Instead, they are shipped with the Silverlight Software Development Kit (SDK). This change enables the Silverlight runtime to be smaller. Because there is no guarantee that the exception messages will be available to end-users, Silverlight developers should never show exception messages to end-users.

Developers can continue to use exceptions as they have in the past (catching them in try/catch blocks) but there is no guarantee the exception message will be available. If the debug resources are not available, a generic error string is used instead: "An error occurred."

  • Removed from Point structure:

  • static bool Equals (Point point1, Point point2)

  • override Equals (object o)

  • override Equals (Point value)

  • override int GetHashCode()

  • void Offset(double offsetX, double offsetY)

  • static explicit operator Size(Point point)

  • Removed from Color structure:

  • static Color FromScRgb(float a, float r, float g, float b)

  • static Color FromRgb(byte r, byte g, byte b)

  • static Color operator -(Color color1, Color color2)

  • static Color Subtract(Color color1, Color color2)

  • override string ToString()

  • static bool AreClose(Color color1, Color color2)

  • void Clamp()

  • static bool Equals(Color color1, Color color2)

  • bool Equals(Color color)

  • float ScA

  • float ScR

  • float ScG

  • float ScB

  • float a, r, g, b;

  • byte a, r, g, b;

  • Removed from Size structure:

  • static Size Empty { get; }

  • bool IsEmpty { get; }

  • bool Equals (Size value);

  • override int GetHashCode ();

  • static explicit operator Point (Size size);

  • Removed from Matrix structure:

  • static bool Equals (Matrix matrix1, Matrix matrix2);

  • bool Equals (Matrix value);

  • Vector Transform (Vector vector);

  • Removed from Rect structure:

  • override string ToString()

  • Rect(Point location, Size size);

  • Rect(Size size);

  • Point Location { get; set; }

  • Size Size { get; set; }

  • double Left { get; }

  • double Top { get; }

  • double Right { get; }

  • double Bottom { get; }

  • Point TopLeft { get; }

  • Point TopRight { get; }

  • Point BottomLeft { get; }

  • Point BottomRight { get; }

  • bool Contains(double x, double y);

  • bool Contains(Rect rect);

  • bool IntersectsWith(Rect rect);

  • static Rect Intersect(Rect rect1, Rect rect2);

  • static Rect Union(Rect rect1, Rect rect2);

  • static Rect Union(Rect rect, Point point);

  • void Offset(double offsetX, double offsetY);

  • static Rect Offset(Rect rect, double offsetX, double offsetY);

  • void Inflate(Size size);

  • void Inflate(double width, double height);

  • static Rect Inflate(Rect rect, Size size);

  • static Rect Inflate(Rect rect, double width, double height);

  • void Scale(double scaleX, double scaleY);

  • static bool Equals (Rect rect1, Rect rect2);

1. Support HTTP/HTTPS requests

2. Support min-bar web services scenarios

a. GET/POST methods

b. On GET/POST requests:  Set standard headers that don’t have security implications.

c. On GET/POST requests:  Set custom headers

d. On responses:  Read  content type

3. On responses:  Get OK or NotFound error codes

4. Leverage browser stack for certain networking features

a. Basic, digest, ntlm, & cookie based authentication scenarios

b. Proxy detection, data compression, caching,

c. Respect browser’s connection limits

5. Support only async requests & only support them on the UI thread

PresentationFrameworkCollection<T> now uses explicit interface implementations to implement IList so when using Add(object) you need to cast to IList.

Before

collection.Add(myobject);

Now

collection.Add ( (GradientStop) myobject);
or
IList list = (IList) collection;
list.Add(myobject);

  • You can now use the Key enumeration instead of using integers (KeyEventArgs.Key property).

  • KeyboardEventHandler/Args is now KeyEventHandler/Args.

  • MouseLeave event is now of type MouseEventHandler (was EventHandler).

  • MouseLeftButtonDown and MouseLeftButtonUp events are now of type MouseButtonEventHandler/Args. (Other types of mouse events remain unchanged.)

  • Accessing the modifier key state (args.Shift/Control, and so on) is now done through the static Keyboard.Modifiers API, and can be done outside of keyboard events. MouseEventArgs.Ctrl and MouseEventArgs.Shift are removed.

  • The Cursors enum has been turned into a Cursor class and a static Cursors class filled with stock cursors, so the typical canvas.Cursor = Cursors.Hand will continue to work. Cursors.Default has been replaced by null. XAML remains unchanged, so Cursor="Default" continues to work in XAML.

Here is an example:

Before

canvas.MouseLeftButtonUp += new MouseEventHandler(onClick);

void onClick (object sender, MouseEventArgs e) {
    Canvas cc = sender as Canvas;
    SolidColorBrush sb = new SolidColorBrush();
    sb.Color = Colors.Red;
    cc.Background = sb;         
}

Canvas.KeyUp += new KeyboardEventHandler(onKeyUp);

Void onKeyUp(object sender, KeyboardEventArgs e){
   if (e.Key == 12) return; 
   bool isShiftPressed = e.Shift;

   if (isShiftPressed) {
         canvas.Cursor = Cursors.Default;
    }

Now

canvas.MouseLeftButtonDown += new MouseButtonEventHandler(onClick);

void OnClick(object sender, MouseButtonEventArgs e) {
    Canvas cc = sender as Canvas;
    SolidColorBrush sb = new SolidColorBrush();
    sb.Color = Colors.Red;
    cc.Background = sb;         
}

Canvas.KeyUp += new KeyEventHandler(onKeyUp);

Void onKeyUp(object sender, KeyEventArgs e){
    if (e.Key == Key.A) return;
    Bool  isShiftPressed =  
    ( ( Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift);
    if (isShiftPressed) {
         canvas.Cursor = null;
    }
}

The TextBlock.FontFamily property has been changed from type string to type FontFamily:

Before

textblock.FontFamily = "Arial";

Now

textblock.FontFamily = new FontFamily("Arial");

Other changes:

  • The FontWeights enumeration has been turned into a FontWeight class and a static FontWeights class filled with stock weights, so the typical textblock.FontWeight = FontWeights.Bold will continue to work.

  • The FontStyles enumeration has been turned into a FontStyle class and a static FontStyles class filled with stock styles, so the typical textblock.FontStyle = FontStyles.Italic will continue to work.

  • The FontStretches enumeration has been turned into a FontStretch class and a static FontStretches class filled with stock stretches, so the typical textblock.FontStretch = FontStretches.Expanded will continue to work.

  • The TextDecorations enumeration has been turned into a TextDecoration class and a static TextDecorations class filled with stock decorations, so the typical textblock.TextDecoration = TextDecorations.Underline will continue to work.

Changes to the Xml API have been introduced to support new DTD parsing functionality as well as support the new XmlXapResolver and XmlPreloadedResolver. This change will impact any XmlReader code that enables DTD support. Additionally, XmlXapResolver has been added as the default resolver for XmlReader.

API Changes

The following API were made to allow for DTDs to be ignored when an Xml file is loaded that contains a reference to a DTD.

  1. Addition to XmlResolver public virtual bool SupportsType(Uri uri, Type type)This method returns true if the Uri can be expressed as a instance of the type parameter. The base class implementation returns true for Stream only.

  2. Addition of DtdProcessing enumerationThe DtdProcessing enumeration expands the allowed actions when the XmlReader encounters a DTD. The enumeration has the following values: Parse, Ignore, and Prohibit.

  3. Removal of XmlReaderSettings.ProhibitDTD propertyThis property has been supplemented by the DtdProcessing property.

  4. Addition of XmlReaderSettings.DtdProcessing propertyThe DtdProcessing property has been added to correspond to the allowed actions when a DTD is encountered. The default value is to Prohibit, which is the same behavior as before this change.

Before

XmlReaderSettings settings = new XmlReaderSettings();settings.XmlResolver = resolver;settings.ProhibitDtd = false;XmlReader reader = XmlReader.Create("fileInXap", settings);

After

XmlReaderSettings settings = new XmlReaderSettings();settings.XmlResolver = resolver;settings.DtdProcessing = DtdProcessing.Parse;XmlReader reader = XmlReader.Create("fileInXap", settings);or
XmlReaderSettings settings = new XmlReaderSettings();settings.XmlResolver = resolver;settings.DtdProcessing = DtdProcessing.Ignore;XmlReader reader = XmlReader.Create("fileInXap", settings);

In order to play by XML rules, XamlReader.Load() now requires you to specify an xmlns inside your XAML file.

Before

XamlReader.Load(“<Canvas/>”);

Now

XamlReader.Load("<Canvas xmlns="http://schemas.microsoft.com/client/2007"/>");

The managed Downloader class has been removed.  Its functionality is replaced by the WebClient class.  There is no change to the javascript Downloader object.

Before

Downloader downloader = new Downloader();
downloader.Open("GET", "http://data.com/resource.xml");
downloader.DownloadProgressChanged += new EventHandler(downloader_DownloadProgressChanged);
downloader.Completed += new EventHandler(downloader_Completed);
downloader.DownloadFailed += new ErrorEventHandler(downloader_DownloadFailed);
downloader.Send();
 
       ...
 
void downloader_Completed(object sender, EventArgs e)
{
    Downloader downloader = (Downloader)sender;
    Stream stream = downloader.GetResponseStream();
}

Now

WebClient webClient = new WebClient();
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged);
webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
webClient.DownloadStringAsync(new Uri("http://data.com/resource.xml"));
 
...
 
void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    if ((e.Error == null) && (e.Cancelled == false))
    {
        Stream stream = e.Result;
    }
}

The constructor that takes a downloader in managed code was removed. Now there is a FontSource constructor that takes a stream.

You should switch over to using the WebClient to download your font and use the stream that the WebClient provides.

Before

TextBlock tb = this.FindName("tb");
tb.FontSource = new FontSource(myDownloader);

Now

void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    TextBlock tb = this.FindName("tb");
    tb.FontSource = new FontSource(e.Result);
}

The Image.SetSource(DependencyObject downloader, string partName) and MediaElement.SetSource(DependencyObject downloader, string partName) methods have been removed.  In order to grab a part from a zip stream, you should use WebClient and then GetResourceStream, as shown below.

Before


Downloader downloader = new Downloader();
downloader.Open("GET", "http://foo.com/myimages.zip");
downloader.Completed += new EventHandler(downloader_Completed);
downloader.Send();

...

void downloader_Completed(object sender, EventArgs e)
{
    MediaElement mediaElement = new MediaElement();
    Downloader downloader = (Downloader)sender;
    mediaElement.SetSource(downloader, "image1.jpg");
}

Now

WebClient webClient = new WebClient();
webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
webClient.OpenReadAsync(new Uri("http://foo.com/myimages.zip"));

...

void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    MediaElement mediaElement = new MediaElement();
    if ((e.Error == null) && (e.Cancelled == false))
    {
        StreamResourceInfo zipResourceInfo = new StreamResourceInfo(e.Result, null);
        StreamResourceInfo imageResourceInfo = Application.GetResourceStream(zipResourceInfo, new Uri("image1.jpg"));
        mediaElement.SetSource(imageResourceInfo.Stream);
    }
}

The default XmlResolver is now the XmlXapResolver, which loads files from the application’s XAP. This allows for an Xml file to be loaded from the XAP without creating a XmlReaderSettings instance.

Before

XmlReaderSettings settings = new XmlReaderSettings();settings.XmlResolver = resolver;XmlReader reader = XmlReader.Create("fileInXap", settings);orXmlReaderSettings settings = new XmlReaderSettings();settings.XmlResolver = resolver;XmlReader reader = XmlReader.Create("fileInXap", settings);XDocument doc = XDocument.Load(reader);

Now

XmlReader reader = XmlReader.Create("fileInXap");orXDocument doc = XDocument.Load("fileInXap");

In addition to these breaking changes, two XmlResolvers have been added.1. XmlXapResolver: This resolver allows content to be loaded from a XAP file when referenced in an Xml file.2. XmlPreloadedResolver: This resolver contains XHTML and RSS DTDs, as well as the ability to add other DTDs to a preloaded cache.

  • Agclr.dll was renamed to System.Windows.dll.

  • System.Xml.Core.dll was renamed to System.Xml.dll .

  • System.Silverlight.dll was renamed to System.Windows.Browser.dll.

Users that generated Web service client proxies for Silverlight 1.1 Alpha and Alpha Refresh projects will have to regenerate their proxies for newer versions of Silverlight. This is because the System.Windows.Browser.Net.SoapHttpClientProtocol class was replaced by the ClientBase<T> class in System.ServiceModel.dll.

Users who relied on WCF ASP.NET AJAX ("WCF JSON") services for their Silverlight 1.1 Alpha and Alpha Refresh projects will have to add SOAP endpoints to their services to work with newer versions of Silverlight.

Users who relied on ".asmx" ASP.NET AJAX ("ASMX JSON") services for their Silverlight 1.1 Alpha and Alpha Refresh projects should not, in most cases, have to change their server side at all (unless SOAP support was specifically disabled, in which case it should be re-enabled).

Users will need to use Add Service Reference instead of Add Web Reference to consume services from Silverlight.

The Loaded event signature is now RoutedEventHandler/Args. Its behavior is unchanged (that is, no differences in tunneling/bubbling.) The namespace for RoutedEventArgs and RoutedEventHandler is changed from System.Windows.Input to System.Windows.

Before

using System.Windows.Input;

canvas.Loaded += 
    new EventHandler(My_Handler);

void My_Handler (object sender, EventArgs e) {
}

Now

using System.Windows;

canvas.Loaded += 
     new RoutedEventHandler(My_Handler);

void My_Handler (object sender, RoutedEventArgs e) {
}

A new HttpWebRequest class has been added, and the BrowserHttpWebRequest class/implementation has been removed.

Before

HttpWebRequest request = new BrowserHttpWebRequest(new Uri("http://Contoso.com"));
HttpWebResponse response = request.GetResponse();
Stream content = response.GetResponseStream();
 
using (XmlReader reader = XmlReader.Create(new StreamReader(content)))
{
    while (reader.Read())
    {
        if ((reader.IsStartElement()) && ("item" == reader.LocalName))
        {
            using (XmlReader itemReader = reader.ReadSubtree())
            {
                while (itemReader.Read())
                {
                    if (itemReader.IsStartElement())
                    {
                        if ("title" == itemReader.LocalName)
                        {
                        }
                        else if ("link" == itemReader.LocalName)
                        {
                        }
                    }
                }
            }
        }
    }
}
response.Close();

Now

HttpWebRequest request = (HttpWebRequest) WebRequest.Create(new Uri("http://contoso.com"));
request.BeginGetResponse(new AsyncCallback(ResponseCallback), request);
 
...
 
// AsyncCallback called back on UIThread
private void ResponseCallback(IAsyncResult asyncResult)
{
    HttpWebRequest request = (HttpWebRequest)asyncResult.AsyncState;
 
    HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asyncResult);
    Stream content = response.GetResponseStream();
 
    using (XmlReader reader = XmlReader.Create(new StreamReader(content)))
    {
        while (reader.Read())
        {
            if ((reader.IsStartElement()) && ("item" == reader.LocalName))
            {
                using (XmlReader itemReader = reader.ReadSubtree())
                {
                    while (itemReader.Read())
                    {
                        if (itemReader.IsStartElement())
                        {
                            if ("title" == itemReader.LocalName)
                            {
                            }
                            else if ("link" == itemReader.LocalName)
                            {
                            }
                        }
                    }
                }
            }
        }
    }
    content.Close();
}

DependencyObject.SetValue is no longer generic.

Before

this.ClipName.SetValue<double>(TextBlock.FontSizeProperty, ((double) this.ClipName.GetValue(TextBlock.FontSizeProperty)) - 1);
this.ClipName.SetValue<string>(TextBlock.ForegroundProperty, "#FF2F2F2F");
this.ClipDate.SetValue<string>(TextBlock.ForegroundProperty, "#FF2F2F2F");
this.ClipLength.SetValue<string>(TextBlock.ForegroundProperty, "#FF2F2F2F");

Now

this.ClipName.SetValue(TextBlock.FontSizeProperty, ((double) this.ClipName.GetValue(TextBlock.FontSizeProperty)) - 1);
this.ClipName.SetValue(TextBlock.ForegroundProperty, "#FF2F2F2F");
this.ClipDate.SetValue (TextBlock.ForegroundProperty, "#FF2F2F2F");
this.ClipLength.SetValue (TextBlock.ForegroundProperty, "#FF2F2F2F");

textblock.GetValue(FontFamilyProperty) used to return a string while textblock.FontFamily returned a FontFamily object. The GetValue behavior has been changed so that it also returns the FontFamily object. Similarly, FontWeight, FontStyle, FontStretch, and TextDecorations have been fixed in the same way.

Before

if (textblock.GetValue(FontStyleProperty) == 3)...

Now

if (textblock.GetValue(FontStyleProperty) == FontStyles.Italic)...

  • ArcSegment.Size changed from Point to Size.

  • Moved the LoadContent method from FrameworkTemplate to DataTemplate.

  • Added a TileMode enumeration to System.Windows.Media, and modified TileBrush.TileMode to use it instead of double.

  • The following functionality has moved from HtmlPage to HtmlWindow: CurrentBookmark, Alert/Confirm/Eval/Prompt, CreateInstance, Navigate*/NavigateToBookmark.

  • The following functionality has moved from HtmlPage to HtmlDocument: Submit, Cookies, QueryString, DocumentUri.

  • The Scriptable attribute has been split into two new attributes: ScriptableTypeAttribute and ScriptableMemberAttribute. Developers who currently attribute their classes with Scriptable can just change the attribute over to ScriptableTypeAttribute. Developers who currently attribute their class members with Scriptable can just change the attribute over to ScriptableMemberAttribute.

  • XmlUrlResolver was removed.

  • OpenFileDialog.Title was removed.

  • System.Windows.WebApplication was removed. Developers should be using the new System.Windows.Application type instead.

  • UIElement::GetRenderSize fixed (was returning Int32, and crashing callers), made read-only, and the dependency property made private.

  • Image.Source changed from string to ImageSource.

  • The following types were moved from System.Silverlight.dll to System.Windows.dll. These changes should only require a recompile for your assemblies to pick up the new assembly location:

    • System.Windows.Controls.DialogResult

    • System.Windows.Controls.FileDialogFileInfo

    • System.Windows.Controls.OpenFileDialog

    • System.Windows.Browser.Net.XBrowserHttpWebRequest and

    • System.Windows.Browser.Net.XBrowserHttpWebResponse are being made internal and will no longer be available for public use.

  • XamlParseException.LineNumber and LinePosition properties changed to Int32 instead of UInt32

  • The delegate LayoutUpdatedEventHandler was removed, and all references were replaced with EventHandler

  • LayoutInformation was moved from System.Windows.Controls to System.Windows.Controls.Primitives

  • DownloadProgressEventArgs.Progress now returns an Int32 instead of a double.

  • System.TimeZoneInfo has been moved to the System.Core.dll.

  • TimelineCollection moved from System.Windows.Media to System.Windows.Media.Animation

  • Several enumerators from the System.Windows.Input.Key enumeration were renamed to match WPF names

  • System.Windows.Visibility enumeration underlying type changed from int to byte

  • StyleSimulations moved from System.Windows to System.Windows.Media

  • TriggerCollection and EventTrigger are now generated for managed code

  • DownloadProgressEventArgs moved from System.Windows.Media to System.Windows.Media.Imaging

  • Orientation moved from System.Windows to System.Windows.Controls

  • Popup was moved from System.Windows.Controls to System.Windows.Controls.Primitives

  • Triggers moved from managed UIElement to FrameworkElement

  • PathFigure.Segments is no longer parser-only writable

  • PathGeometry.Figures is no longer parser-only writable

  • GeometryGroup.Children is no longer parser-only writable

  • GradientBrush.GradientStops is no longer parser-only writable XmlReader.HasValue was changed from virtual to abstract.

  • Group.Synchronized(Group) and Match.Synchronized(Match) in the System.Text.RegularExpressions namespace were removed.

  • ScriptableObject has been renamed as ScriptObject.

  • ScriptObject no longer implements IDisposable (if you happened to be using that).

  • HtmlDocument.GetElementById was renamed from "GetElementByID".

  • HtmlElement.Id was renamed from “ID”.

  • Scriptable endpoints must be registered using HtmlPage.RegisterScriptableObject. This method used to exist on the System.Windows.WebApplication type.

    • You no longer need to attribute a class with [Scriptable] to register it. Instead you must have at least one PME on the registered instance marked as [Scriptable] to successfully register the instance.

  • The generic type signature for ScriptObject.GetProperty<T> was removed. Instead, you must explicitly cast the return value to the desired type.

    • ScriptObject.GetProperty and ScriptObject.Invoke/InvokeSelf return values are typed as object.

    • Return values that point at DOM objects or JavaScript objects (HtmlDocument, HtmlElement, HtmlObject, ScriptObject) are automatically returned as the most derived type possible. However, a developer still has to explicitly cast from object to the appropriate type.

    • All numeric values returned from GetProperty and Invoke/InvokeSelf are typed as double because of cross-browser limitations. If you were expecting Int32 values, you must now explicitly convert the returned numeric value using Convert.ToInt32.

  • The HttpUtility type’s public signature was reduced to just a pair of HtmlEncode/Decode and UrlEncode/Decode methods.

  • The System.Windows.ApplicationUnhandledExceptionEventArgs type in System.Silverlight.dll was removed, as well as the accompanying ApplicationUnhandledException event on System.Windows.WebApplication. Developers should instead start using the unhandled exception support exposed on the new Windows Presentation Foundation (WPF) application type.

  • The return type of System.Windows.Browser.BrowserInformation.BrowserVersion changed from string to System.Version.

  • System.ApplicationException has been set to obsolete and references to this class have been removed.

  • MultiScaleImage used to have a Viewport property which was of type Rect. It has been changed to be two properties, ViewportOrigin (which is a Point) and ViewportWidth (which is a Double).

Property Value Changes

The following properties are now PointCollection instead of Point[]:

  • System.Windows.Media.PolyLineSegment.Points

  • System.Windows.Media.PolyBezierSegment.Points

  • System.Windows.Media.PolyQuadraticBezierSegment.Points

  • System.Windows.Shapes.Polygon.Points

  • System.Windows.Shapes.Polyline.Points

The following property is now DoubleCollection instead of Double[]:

  • System.Windows.Shapes.Shape.StrokeDashArray

Parameter Name changes (most applicable to Visual Basic applications)

  • RenderTargetBitmap.Render parameter renamed from 'element' to 'visual'

  • MediaElement.GetValue/SetValue: Parameter renamed from 'property' to 'dp'

  • UIElement.TransformToVisual: Parameter renamed from 'uiElement' to 'visual'

Dependency Properties made Private

  • TransformGroup.Value is now a private DP

  • Geometry.Bounds is now a private DP

  • FrameworkElement.Resources is now a private DP

  • TextBlock.Inlines is now a private DP

  • Run.Text is now a private DP

  • EventTrigger.RoutedEvent is now a private DP

  • KeySpline.ControlPoint1 and ControlPoint2 are now private DPs

  • Stroke.StylusPoints is now a private DP

  • Stroke.DrawingAttributes is now a private DP

  • StylusPoint.X, Y, PressureFactor, Color, OutlineColor, Width, and Height are now private DPs

  • StylusPoint.PressureFactor now has no generated accessors (DP only)

  • TextBox.SelectedText, SelectionLength, and SelectionStart are now private DPs

  • RowDefinition.ActualHeight, ActualWidth are now private DPs

The System.Net.Sockets namespace added in Silverlight 2 provides a managed implementation of the sockets networking interface for developers who need to tightly control access to the network. For more information, see Working with Sockets.

Show:
© 2014 Microsoft