Silveright Breaking Changes between Mix and Version 1.0

I’m using the post to aggregate my other post into a comprehensive list of V1.0 breaking changes.

 

1. There are a set of ASX tags we previously silently ignored that we will now result in a MediaFailed event. These are: PREVIEWMODE, BANNERBAR, PARAM, REPEAT, STARTMARKER, ENDMARKER and some MOREINFO tags We will also throw a MediaFailed event if we encounter fallback URLs (e.g. multiple REF elements in an ENTRY tag).

2. The FontURI for a Glyph element will be resolved asynchronously rather than synchronously. The means that text displayed via the Glyphs element will appear once the font is downloaded – in most cases after other content has already appeared.

3. We report a greater number of parser errors. Developers will mostly likely see this in cases where they are setting a numeric value to an invalid value. In Mix bits, we’ll treat the invalid value as “0” where we throw an error in V 1.0. Note that internally, we’ve seen a number of samples with this issue. One way we’ve seen this is with the following:

 

<TextBlock Width="Auto" Text="Created By:" />

 

“Auto” is not supported in Silverlight and in Mix bits caused the Width to be set to 0. Given we don’t clip TextBlock by Width, this didn’t impact the application but will generate a V 1.0 error.

 

4. We’ve changed OnLoad, OnError, OnResize, OnFullScreenChange to be function pointer based rather than being string based. In order to developer Silverlight content that works on both Mix and V 1.0 bits, you’ll need to do the “if check” I described in a previous post.

 

      // Hook resize

      if (Sys.Silverlight.checkVersion(_ag, "20416")) {

        // Mix code path – use strings

        _ag.content.onResize = "javascript:onResize";

        _ag.content.onFullScreenChange = "onFullScreenChanged";

      } else {

  // RTM code path – use function pointers

        _ag.content.onResize = onResize;

        _ag.content.onFullScreenChange = onFullScreenChanged;

      }

 

5. The MediaElement Position property value can be greater than the MediaElement NaturalDuration property value. This will mostly be seen in broadcast cases where previously we returned 0 for the “Position” value but now we return the play time.

6. Elements in <*.Resource> blocks must be named (which will almost always be the case in Mix bits). What this means is you must have an x:Name property for all content in a <*.Resources> section.

 

      <!-- OK with Mix bits -->

      <Canvas.Resources>

        <Storyboard>

      <!-- Content here... -->

        </Storyboard>

   </Canvas.Resources>

      <!-- Must add x:Name -->

      <Canvas.Resources>

        <Storyboard x:Name="name">

      <!-- Content here... -->

        </Storyboard>

   </Canvas.Resources>

7. You can no longer use “\” in URIs. At Mix, this did not work correctly across platforms and caused some confusion so we’ve made this break consistently across all platforms. All web resources paths that use a “\” should replace them with “/”. For example, use "/assets/images/bg.jpg" instead of "\assets\images\bg.jpg".

8. The PathFigure IsFilled property is no longer supported. Note that IsFilled was silently ignored in the Mix release and we now produce an error if this is used.

9. AddEventListener now returns a token that needs to be passed to removeEventListener to un-register event handlers. If you are using removeEventListener (which didn’t work consistently in the Mix bits), you’ll need to modify the JavaScript calls to addEventListener and removeEventListner as shown below:

 

    // Silverlight Beta (Mix)

    obj.addEventListener("MouseEnter", handler);

    obj.removeEventListener("MouseEnter", handler);

    // Silverlight Version 1.0

    var eventId = obj.addEventListener("MouseEnter", handler);

    obj.removeEventListener("MouseEnter", eventId);

    // Or if using XAML to add the event handler

    // Silverlight Beta (Mix)

     <Canvas x:Name="obj" MouseEnter="javascript:handler">

    sender.findName("obj").removeEventListener("MouseEnter", handler);

    // Silverlight Version 1.0

     <Canvas x:Name="obj" MouseEnter="handler">

    sender.findName("obj").removeEventListener("MouseEnter", 0);

 

10. The downloader component no longer supports synchronous downloads and therefore the synchronous argument to the “open” method. See this post for details.

11. The syntax “javascript:” is no longer supported when specifying event handlers. See this post for details.

12. The Silverlight plug-in has been renamed from “WPFe Plug-In” to “Silverlight Plug-In”. This breaks browser detection used in the Mix version of “silverlight.js”. This version of “silverlight.js” supports both the Mix and RTM plug-in names.

13. Animations declared in markup must include a TargetName and a TargetProperty.

14. The “Visibility” property no longer accepts “Hidden” (use “Collapsed” instead). See this post for details.