Microsoft have recently released the second beta of Visual Studio 2008. Along with this there are new "refreshes" of Silverlight 1.1 Alpha and Blend 2. There is a new (and much larger) Silverlight 1.1 SDK, and you will need to also download the new Sliverlight tools to develop projects in Visual Studio 2008. Links to all the downloads are provided here.
I have been updating my SilverNibbles application to run against the new 1.1 Alpha, which was fairly straight-forward. I just needed to replace the Silverlight.js and update the createSilverlight method slightly and everything ran as expected.
There was however one nasty bug resulting in an exception with "Catastrophic Failure" as its error message!
The problem was with the hack I was using (along with many other Silverlight users) to create a timer. Previously, I could simply create a storyboard with a double animation using the following XAML:
<Canvas.Resources> <Storyboard x:Name="timer"> <DoubleAnimation Duration="00:00:0.08" /> </Storyboard> </Canvas.Resources>
Unfortunately, when you call timer.Begin() in the new Alpha refresh you will get the "catastrophic failure" exception. The problem is that the DoubleAnimation needs a name and a target. This is easily fixed by creating a hidden rectangle for it to control:
<Canvas.Resources> <Storyboard x:Name="timer"> <DoubleAnimation x:Name="animation" Duration="00:00:0.08" Storyboard.TargetName="InvisibleRect" Storyboard.TargetProperty="Width" /> </Storyboard> </Canvas.Resources> <Rectangle Visibility="Collapsed" x:Name="InvisibleRect" />
No comments:
Post a Comment