Feed on
Posts
Comments

Last week the the February 2007 WPFe CTP shipped.  If you play with the CTPs you get used to breaking changes between each CTP versions.  The products are not stable and are still in flux so it’s not surprising that namespaces or class names change between drops.

There are a couple breaking changes in the February drop.  Microsoft has posted a short article describing the two breaking changes.  Unfortunately I think there is a mistake in the article.  I updated the Game Of Life sample today to work with the new CTP and could not get it to work based on the syntax in the article.  Using the code in the SDK samples worked correctly however.

Wrong way

 Here are the relevant bits from the incorrect article (errors in red):

The February 2007 CTP agHost.js file has been updated significantly to:

  1. Check for installed major, minor, and build-version information of the control.
  2. Detect supported browser versions.
  3. Accept required major version, required minor version, and required build parameters to the agHost() function.

The new function signature is the following:

function agHost( hostElementId,  id,  width,  height,  backgroundColor,
 sourceElement, source,  isWindowlessMode,  reqMajorVer,  reqMinorVer,
 reqBuildVer,  framerate,  errorHandler)

This new agHost.js file creates two breaking changes that will require changes to Web sites that are built with “WPF/E”.

  1. The updated function signature contains new arguments: reqMajorVer, reqMinorVer, reqBuildVer. Each <javascript> block that creates a “WPF/E” (Silverlight) control using agHost.js will require these new parameters. The version number for the February 2007 CTP is as follows:
    • Major = 0
    • Minor = 8
    • Build = 5

    So, to specify the February CTP as the required minimum version, you should pass ‘0′, ‘8′, ‘5′ for the reqMajorVer, reqMinorVer, reqBuildVer arguments, respectively.

  2. You must replace the December CTP SDK agHost.js file with the February CTP SDK agHost.js file, in order for your Web site to work with the February CTP runtime. The agHost.js file that was released with the December CTP was hard-coded to check for a previous version of “WPF/E” on the Microsoft Internet Explorer browser. Therefore, the December agHost.js cannot recognize the February CTP, and will continually point users to download the new version. Note also that the December CTP runtime will expire on February 18, 2007, and users must upgrade to the February CTP in order to continue viewing “WPF/E” content.

    The new agHost.js file that ships with the February CTP now accepts a minimum version as a variable, and will be compatible with future versions of the “WPF/E” plug-in.

Right way

 

<script type='text/javascript'>
new agHost(”wpfeControlHost”,
“wpfeControl”, // ID of the WPF/E ActiveX control we create
“1024″, // Width
“530″, // Height
“black”, // Background color
null, // SourceElement (name of script tag containing xaml)
“xaml/piano.xaml”, // Source file
“false”, // IsWindowless,
“24″, // MaxFrameRate
null, // OnError handler (method name — no quotes)
0, // Minimum major version required
8, // Minimum minor version required
5); // Minimum build required

</script>

-Walt

RSS Like this article? Subscribe to the RSS feed.

2 Responses to “Fixing your WPFe pages to work with Feb 2007 CTP”

Leave a Reply