Monday, October 6, 2008

From Silverlight 2 Beta 2 To RC0

On September 25th Microsoft released Silverlight 2 RC0 (for developers only). At the end of September I migrated my SL 2 Beta 2 application to new version. First my project didn't compile, later I had some run-time errors ... Finally I have working SL2 RC0 application. 

Some changes I have noticied when I did migration:

  1. generic.xaml was moved underneath the themes folder under control library project

  2. IsEnabled property was added to Control class

  3. RoutedEventArgs.Source  was changed to OriginalSource

  4. MouseEventArgs.Handled was moved  to MouseButtonEventArgs (SL team: In Beta 2 timeframe, we heard a lot of feedback that a lot of events are marked as Handled internally. This had caused a lot of troubles. Generally speaking, you should only mark an event as handled when other event handlers expects you to do so. But it's unlikely that is a requirement, especially for events using MouseEventArgs, such as MouseEnter/Leave/Move. Leave this property will cause more confusions than the problems it solves. So we decide to remove it from some events, while keep it on the other, when necessary. More information: http://silverlight.net/forums/t/30901.aspx)

  5. CancellingEdit and CommittingEdit events of DataGrid control were removed (SL team: The event was there in Beta 2, but it didn't work correctly so it was removed for RTM.  We are hoping to bring it back in SL 3. More information: http://silverlight.net/forums/t/30533.aspx)

  6. Some changes in styles and templates (When I compiled my project, I got warnings and errors:  " The property '_UnknownContent' does not exist on the type 'ResourceDictionary' in the XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation' " and " The type 'List`1' is inside a ResourceDictionary and does not have a key". I had errors, because I had used skins like here.  I changed some namespaces and styles to new format, but I still had build errors.  Finally, I  created new project, copied files from old project and I got warnings  - not errors!  Amazing, but it helped me!  I have ignored warnings and my project has worked correctly! )

  7. DataGridCellsPresenter, DataGridColumnHeader, DataGridColumnHeadersPresenter, DataGridDetailsPresenter, DataGridRowHeader, DataGridRowsPresenter classes were moved to namespace System.Windows.Controls.Primitives

  8. ContentPresenter derives from FrameworkElement instead of Control

  9. Some changes in animations:  You get exception " Operation is not valid on an active Animation or Storyboard. Root Storyboard must be stopped first."  when you change  Storyboard.TargetNameProperty  on an active Storyboard. You should stop Storyboard before changing the property.

  10. Some changes in ContentControl: Now content doesn't stretch automatically to borders of the control. I set VerticalContentAlignment and HorizontalContentAlignment properties to Stretch value.

  11. IsTabStop default value was changed to true.

  12. Some changes in databinding:  With Beta2 you can make two way binding without specyfing Path. Now you get exception "Two way binding requires Path"

  13. Some changes in wrapping text for TextBlock:  Parts of the text with more than one word are hidden. With Beta2 it works correctly, it seems to be a bug.

For more information about changes  you see  Breaking Changes Since Beta 2 document, RC0 documentation or Silverlight forums.