My previous post talks about learning some Silverlight and going through some of ScottGu's articles about getting started with Silverlight.  As I have been trundling through then I have started to notice one thing that is getting particularly irritating.

When you're styling up your application, you need to be very careful about typing the Setter properties correctly.  I admit, I am using Visual Studio and not Expression <insert useful variant here>, but I would still expect a little more intelligence or when editing the XAML.

Let me explain...

Consider the following XAML from my App.xaml file in Scott's article:

<Style x:Key="ThumbNailPreview" TargetType="Image">
<Setter Property="VerticleAlignment" Value="Center" />
<
Setter Property="Margin" Value="7,7,5,5" />
<
Setter Property="Height" Value="55" />
<
Setter Property="Width" Value="55" />
</
Style>

Note how (me being me), I have spelt VerticalAlignment incorrectly.  The result of this will be that the part of the XAML that uses that Style will not render correctly and seems to cause the entire application to 'white-out'.  Now, when this is a Style that is visible to us at design-time, then the design view of the XAML will go blank and we'll get some kind of indication that something is not correct.  We don't know what is incorrect and no compilation errors appear.  In which case, get someone to check your code over for you (at the end of the day, you typed it wrong and someone else will probably pick up your mistake quicker, we all know how it is ^^).

So cool, we can fix the problem - lovely.  However, if the Style is being used by a control that is in a template for data binding, the problem does not reveal itself in design view insider Visual Studio.  It lurks somewhere in a dark corner waiting for you to run your application and bind some data to it.  At which point; BLAM!, you're application pulls a whitey and the screen goes blank.  Ye then need to go back to Visual Studio and figure out what was wrong.  Again, get someone to look over your shoulder perhaps to quickly spot your blatant typo.

I'm sure Expression Whatever is very good at all this Style stuff, and I will shortly try it out, but I really was hoping for better intellisense in Visual Studio to let me know what properties I can use in setters for the Style's TargetType.  Maybe v.Next will do this?  that would be nice.


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
posted @ Wednesday, September 17, 2008 1:03 PM | in Visual Studio Silverlight

Comments

No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  


Please add 6 and 5 and type the answer here: