Silverlight Limitations

November 20th, 2007

After a couple weeks of learning Silverlight, I’ve come across a number of annoyances which I know will come up again and again.

Centering text

There’s no Alignment attribute for TextBlocks. To center text you need to use an on-load event to reposition the text after it’s created.

No inline custom controls

Let’s say you know you’ll use centered text a lot. So you create a custom control with a TextBlock that centers itself. You want to be able to easily insert is into your XAML.

But you can’t. As I understand it, the purpose of XML is to allow things like this. Even though Silverlight has its own schema to define the tags that can be used, it would be nice to be able to add your own. Even something like a CustomControl tag would be enough. But with Silverlight you have to go back to an on-load event.

Copying brushes

This is one I just experienced a few minutes ago, and I’m not sure how significant it will be. Say you’re making something like a drawing program, and you want to be able to select a color, or brush, and paint with it. I’d like to be able to do something like this:

You can’t, because you would have two objects using the same brush. Even something like r.Fill = currentBrush.Clone() would be nice. This is what I ended up with:

Eww.

But, Silverlight 1.1 is still in alpha, so it’s still being tweaked. There’s a chance some of this will be much easier in the final version.

Leave a Reply

Name

Website

Comment