This is a continuation of What I Learned About Silverlight, Part 1
3. Class libraries cannot be shared between Silverlight applications and their hosts.
I wanted to create some classes that I could share between the Silverlight application and the host web application. This was for the purposes of Xml serialization.
However, Silverlight won't package non-Silverlight class libraries in the .XAP. And you cannot reference a Silverlight class library from a standard web application.
So I could not create a class library to share.
My work around was to include the classes in the Silverlight application, then to also include the same files (as links) in the web application. I did it as links to avoid duplicate files.
4. Silverlight does not support Xaml triggers.
I wanted to have some MouseEnter and MouseLeave triggers. However, Silverlight does not support Xaml triggers. To get around this, I had to use full event handlers for the events. From these event handlers, I was able to initiate any storyboards that I needed to.
5. WebClient UploadProgressChanged event does not fire.
I am including photo uploading in the application. For this, I want to include a progress bar to see the progress of the upload. WebClient has an UploadProgressChanged event, however, when using WebClient.OpenWriteAsync(), this event is never fired. I've seen on the forums that I'm not the only one with this issue. Hopefully, they will fix it in a future Silverlight update. There are some work-arounds like sending the file in chunks, but at this point, I don't want to go to that much trouble.
In addition, there is no event to be triggered for when the upload completes. So how am I supposed to know when to hide the progress meter?
For downloading, WebClient is wonderful to work with though.
6. No arbitrary drawing.
I've said this before, but I'll mention it again. Silverlight does not allow drawing arbitrary shapes on a canvas. Instead, you need to create shape primatives (ie. shape controls) and add them to your canvas. For example, to draw a circle, you need to create a circle object and add it as a child control to your canvas.
This is fine for a few shapes, but what if you want to create a CAD type of program? If you have a grid on your canvas, you need to add a line control object to your canvas for every horizontal and vertical line. Doable, but very hard to manage.
Anyways, there you have it. Silverlight is a nice platform to work on if you're writing the right application. However, at this point in time, it's still not good enough for some types of applications.