I guess I could have named this post "Yet another beta 2 post". I figured, as everyone else, I needed to at least mention that Beta 2 was released last Friday (and it can be downloaded here). I actually sat waiting for it to arrive and was excited when it was actually released. I'm not sure if that makes me innovative or sad.
I sat for hours reading through the changes and working on upgrading our big project from beta 1. I think even after a week that there are still a few bugs and kinks that need to be removed but I am happy with all of the changes that were made. I am very happy to see that Silverlight and it's brother Windows Presentation Foundation are no longer complete strangers.
No, I do not plan on listing all the changes. Their were to many for me to do that with. If I run into anything significant, I will write a post for it. Just check out Scott Guthrie's post to get the basics. He also includes a few links which lead to even more detailed information.
posted by Todd at 7:07 am
Some events in Silverlight are known as routed events. The most common of these are mouse or keybaord events such as MouseEnter or KeyDown. A routed event bubbles up (automatically refires) through the interface tree.
For instance, suppose you have a checkbox which is on top of a border control. You want to cause something to happen when the user clicks on the border control itself. To do this, you would handle the MouseLeftButtonDown event. When the user licks on the Border control the event is handled and your action is succefully performed. However, to your surprise, the same handler is also executed when the user clicks the CheckBox. This is because the event is routed and is passed through to the other elements in the tree.
It is important that you understand this because if you don't, you will not recognize why your interface is responding in ways you didn't plan. However, Silverlight does offer a way to assist in stopping this bubbling process in the form of the Handled property.
Lets return to our previous example. In this situation, we only want the MouseLeftButtonDown to do anything when the Border is clicked, not the CheckBox. You do this by creating a MouseLeftButtonDown handler for the CheckBox and setting the Handled property (which is found in the MouseEventArgs class) to true (or True if you are a VB person). This does not actually stop the routed event from bubbling but the information is passed along the chain. Within the Border's MouseLeftButtonDown event handler you can check if the Handled property is set to true or not, which would indicate to you that somewhere in the chain, the event has already been handled.
Note: Silverlight 2.0 beta 2 made some changes related to event bubbling. Now, if you set the Handled property to true, the event is canceled from bubbling to the next controls in the tree. This is exactly how it works in Windows Presentation Foundation.
posted by Todd at 9:30 am
The RepeatButton is one of the new controls that came with Silverlight 2.0 Beta 1. It is nearly identicaly to the standard Button control but it will repeatedly fire the Click event as long as you continue to hold down the mouse button on it.
I was working on a project last night where I was using the RepeatButton for the first time. For some reason, the Click event only ever fired once for me. I continued to test and research and couldn't figure out the problem. As usual, I slept on the issue and looked into it more this morning. I was able to figure out what the issue was but I still don't know why.
I discovered that most of the examples I could find, for the RepeatButton, included the IsTabStop property set to False. I couldn't figure how this could be involved but decided to test it anyway. To my suprise, it worked.
I did further reasearch and was unable to determine why this works this way. The bootom line is that IsTabStop MUST be set to False for the Click event to be fired repeatedly as designed. I can only assume that this is some bug with this early version of the controls.
posted by Todd at 9:49 am
After I upgraded my system to using the new Silverlight 2.0 components I immediately realized the vast amounts of changes that had occurred which broke any Silverlight 1.1 application. A quick search on the internet brought me to this Microsoft site which lists the large amount of breaking changes between the two versions.
Since Silverlight 1.1 was only an Alpha version, changes like this are totally expected so I was not shocked or surprised. It is just a matter of making adjustments. However, some people do not take to change as easily as others.
The Microsoft article does a well enough job in covering all of the breaking changes so I am not going to bother re-listing them here. However, I will mention a couple of them that I feel deserve it.
The first big changes you are going to run into are name and file location changes. For instance, the main dlls used in Silverlight 1.1 have had name changes. The name changes are improvements, in my opinion, as they now more closely resemble the names used within Windows Presentation Foundation (WPF). Those changes are:
Agclr.dll is now System.Windows.dll
System.Xml.Core.dll is now System.Xml.dll
System.Silverlight.dll is now System.Windows.Browser.dll
I noticed another change that I feel should be carefully considered when designing any application in Silverlight 2.0. All exception messages have been removed from the Silverlight framework and stored in the SDK. The good news here is that the runtime is smaller because of this. The bad news is that you can no longer guarantee that an end user will see an appropriate error message, rather then the generic "An error occurred".
There are many more changes that I didn't mention. Most articles I have seen related to this subject are suggesting that the best approach is most likely to simply start from scratch. In this situation, I tend to agree.
posted by Todd at 12:36 pm
Allow me to be yet another blog announcing that Silverlight 2.0 beta has been officially released. As expected, it was announced and released during MIX. Everything you need can be found at www.Silverlight.net. However, let me post a few links to make it even easier for you:
A word of warning, make sure you have all the old versions of the above components uninstalled before attempting to install anything new. It just makes it easier.
Now that I have everything installed I am ready to go play. I will start posting some actual example articles very soon.
posted by Todd at 10:03 pm
First we had Silverlight 1.0. Then we were teased with an alpha version of Silverlight 1.1 simply to whet our appetite. Now the most recent news is that Silverlight 1.1 is being renamed (replaced by) Silverlight 2.0. What does it all mean?
Well, from what I have read, I am looking forward to this new release. It seems Microsoft was working on expanding what would be included in 1.1 until the list got so big that they felt nine more points had to be added bringing Silverlight up to a new full version rather then the intended partial update. The list of functionality and controls that are planned to be in this version closely resemble what is currently available in Windows Presentation Foundation (WPF).
Beyond just the new controls, it cannot be overlooked that the true power behind Silverlight 2.0 will be the robust, yet minimized, .NET framework. I have seen several different lists of what parts of the framework will ship with Silverlight 2.0 but nothing is definitive yet. They are attempting to keep the size of the component as small as possible while providing the most important and useful pieces.
The biggest question now is when? When can we too play with this new tool? Well, no matter how much I search and ask, no one is talking. It seems Microsoft has gone into quiet mode about Silverlight pending the upcoming "announcements" at MIX 08 (which is later this week). My best guess is that the promised Silverlight 2.0 beta will be announced and released at (or just after) the MIX.
For those that haven't seen it yet, Scott Guthrie has recently posted a great article which demonstrates Silverlight 2.0. He also recently posted a related article on using the Community Technology Preview (CTP) of Expression Blend to create a sample Silverlight 2.0 application.
posted by Todd at 2:36 pm