Saturday, 8 March 2008

More thoughts on Silverlight 2.0 beta 1

I'm continuing to update my SilverNibbles application in an attempt to try out some of the new features in the latest Silverlight beta.

In addition to the things I mentioned in my previous post, here's some things I liked, and some things I learned:

Being able to reference UserControls directly in XAML is brilliant. It has greatly simplified a lot of the code in SilverNibbles.

Intellisense for XAML is great!

The cursor keys finally work properly. Previously they didn't give any key-down events, only key-up.

There is a new DispatcherTimer object that can be used for game loops in preference to having to use an animation of an invisible object.

Buttons can respond to keyboard events even if their container is invisible. You need to set the IsEnabled property to false if you don't want them to be triggered by the space bar or enter key.

Layout panels are nice, but can actually cause a lot of headaches wondering why your user-control is sizing itself in unusual ways. Sometimes Canvas is still the most straightforward thing to use.

The app.xaml file is nice in that it lets you set Style and Template resources. What I would really like to do is something like this:

<Application.Resources> 
<SolidColorBrush x:Name="BackgroundBrush" Color="White" /> 
...

and then in a user control:

<Rectangle Fill={StaticResource BackgroundBrush}/>

I haven't done enough WPF to know whether this would be allowed in WPF, but it would be a very useful feature if you could.

Finally, I have had issues with FireFox and IE not appearing to download the very latest versions of my Silverlight apps from my webserver. I know the latest version is online, but sometimes the previous version appears in my browser. I'm not quite sure exactly why this is happening yet.

No comments: