Upgrading your project from Silverlight 1.1 Alpha to Alpha Refresh
I am by no means a Silverlight expert. That said, here's the things I personally needed to do to update an existing Silverlight 1.1 Alpha project to Silverlight 1.1 Alpha Refresh.
First, I loaded up my existing Visual Studio 2005 project in Visual Studio 2008 Beta 2 and went through the conversion wizard. No warnings, no errors, but the wizard won't touch your JavaScript.
Next, I add a FRESH New Silverlight Project to my solution. I added this project for reference, and I'll delete it later.
I did a diff between the .js's that I had and the new one. Notice a few changes:
Silverlight.createObjectEx({ source: "Page.xaml", parentElement: document.getElementById("SilverlightControlHost"), id: "SilverlightControl", properties: { width: "100%", height: "100%", version: "1.1", enableHtmlAccess: "true" }, events: {} });
You don't refer to the Silverlight object via Sys.Silverlight any more. Also, enableHtmlAccess takes a string "true" when before a boolean worked for me. Also, the version has changed to "1.1".
Previous Silverlight project wizards or samples might have put this in your body's onload:
<body onload="document.getElementById('SilverlightControl').focus()">
Now, if you want your control to have initial focus, you need to add the onload in a friendlier way:
// Give the keyboard focus to the Silverlight control by default document.body.onload = function() { var silverlightControl = document.getElementById('SilverlightControl'); if (silverlightControl) silverlightControl.focus(); }You'll also need to copy the new "minimized" Silverlight.js file and notice that its size has been nearly cut in half by the process. Shiny.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Comments are closed.