The one thing that puzzles me nowadays is Silverlight. I use version 3 (because of VS 2010 RC), and heard a lot of good opinions about 4, but I just can’t get hold on it. I have a feeling that it’s not an integral part of the framework (which is true in a sense). After I read Introducing Microsoft Silverlight 3, I thought it’ll be just as easy as put a web page together in Visual Studio. But it’s not. Somehow the entire logic seems to be different behind it. I mean, I just wanted to do simple things in the way I always do them, and have a damn hard time figuring out the Silverlight way of it.
Some examples: play an animation on an event. Okay, it’s fair easy, but I wanted to play it only, if the animation has stopped (in other words, when it’s not playing). But I couldn’t find any property or method to determine whether an animation has finished or not (only a completed event, which was a hard compromise).
I’ve always liked constructors, they provide such a nice way to initialize a variables properties, etc. But when I work with Silverlight, I always have to discover that the developers of it didn’t share my enthusiasm. It’s maybe just my perversion, I found myself a couple of times subclassing ASP.NET server controls just to give them constructors of my taste. But why can’t a DoubleAnimation or a StoryBoard have constructors? I can’t imagine it.
My arch enemy during the development was the static method of StoryBoard.SetTargetPropety(), which takes a Timeline and a PropertyPath type. I can’t even count the errors produced at runtime, because I couldn’t figure out the proper string syntax of PropertyPath. I’ll surely write a post about it.
What made me somewhat frustrated was that I’d liked to dynamically change an image’s source in codebehind. Expected something like this:
im.Source = “/Project;component/Pic/menu1.png”;
But the solution was, which gave me nightmares for days:
string imagesource = “/Project;component/Pic/menu1.png”;
im.Source = ims.ConvertFromString(imagesource) as ImageSource;
Why? Who? How am I supposed to even suspect the existense of a class named ImageSource. What benefit can it provide? As I read the class definition, it helps in some cross-class conversion, but this was definitely not the case here.
I know that I didn’t dig myself enough into this great technology, which would be destined to beat Flash (of which I have no experience) and I truly respect and amaze those, who are able to build such a system, but as a somewhat experienced .NET developer, I excepted that it’ll come into hand in a short time. Anyway, I continue my research in it, books are on their way from Amazon, and I hope I’ll gain a deeper understanding of the whys and hows of its architecture, but till then, I’d be a little disappointed.