Avalon Beta 1 RC Breaking Changes
Breaking changes are a fact of life when living on the bleeding edge of betas and CTPs, especially for technologies like Avalon and Indigo which haven't officially shipped yet. There have been lots of changes between the March CTP and Beta 1 RC, and there will be lots more to come. Remembering the CLR/.NET Framework changes between Beta 1, Beta 2, and the RTM of v1.0, I know we're still in for quite a ride! At least this time I don't have to try to keep a 1600-page book in sync with all the changes! :) Good luck, Chris and Chris!
I thought I'd share the changes I ran into with my playing cards sample as I moved it from the March CTP to Beta 1 RC.
In source code, the only change I made (in Hand.xaml.cs) was to make Hand derive from Viewbox rather than Grid. I could have left it alone, but it felt more natural to have Hand be a Viewbox rather than a Grid containing a Viewbox. The March CTP compiler had prevented me from doing the former.
Of the four XAML files in the complete sample, I only had to change one of them (Card.xaml). But there were lots of changes, indeed:
- x:StyleID changed to Name
- TransformCollection changed to TransformGroup
- *Alias(Target=Background) changed to {TemplateBinding Background}
- SourceId and TargetId (in EventTriggers) changed to SourceName and TargetName
- DeactivateAction (in EventTriggers) changed to StopAction
- On the ParellelTimelines, I had to play around with Duration and FillBehavior settings to get the desired effects when pairing the MouseEnter/MouseLeave animations. It was hard to get right, but there should be some changes in this area in the future to make things easier.
- I had to alter the paths in my SetterTimelines in order to animate my transforms. For example, (Grid.RenderTransform)[0].(RotateTransform.Angle) changed to (Grid.RenderTransform) .(TransformGroup.Children) [0].(RotateTransform.Angle)
- In all of my DrawingBrushes, I removed the Viewbox attribute (Viewbox="0 0 1468 2053"). Another option would have been to set ViewboxUnits="Absolute" . Why? The meaning of the coordinates has changed, with the default now being ViewboxUnits="RelativeToBoundingBox". But since the coordinates now get calculated automatically if you don't specify them, I just removed them altogether.
- On the button, ID changed to Name. This was a big change to FrameworkElements that all Avalon components are likely to run into.
There were a lot more breaking changes that my sample managed to avoid because there were two ways to do certain things in the March CTP and now there's only one way to do them. I chose the way that survived the upgrade, but you could easily run into these changes. For example:
- The deprecated attribute syntax described here (such as using *null instead of {x:Null} ) was still supported in the March CTP, but not in Beta 1 RC. Upgrading means you're now forced to make the switch.
- You can no longer use System.Windows.Shapes inside of a DrawingBrush. Instead, you must use the new Drawing classes: DrawingGroup, GeometryDrawing, & ImageDrawing. This is a big change, but it has lots of benefits. A DrawingBrush can now exist in a Resources dictionary, and since the Drawing classes inherit from Animatable (rather than FrameworkElement), a lot of properties are removed (which were never supported inside a DrawingBrush anyway), giving a much smaller memory footprint.
- There have been a number of changes to the way styles are defined. For example, you no longer embed controls or a VisualTree inside them. You set properties, such as the "Template" property, which holds a ControlTemplate much like what the VisualTree used to be.
Are you struggling with any other breaking changes that I didn't cover? Let me know and I'll see if I can help!
Comments
- Anonymous
June 02, 2005
Hello, I think all these changes give more natural changes to XAML. However I believe that the path thingy is really difficult and seems too unnatural in the sense that deriving this string is not easy for a dev or designer outside of microsoft (Grid.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)
if it was something like the string below it could have been really easy just like a general programming language syntax(C# like):
Grid.RenderTransform.TransformGroup.Children[0].RotateAngle
because i am always confused about the positioning of the paranthesis
If will be really nice of you if you could just pass on my comments to the team.
Congratulations to the team for the release of Avalon BETA1 RC.
Umer
Avalon Addict - Anonymous
June 02, 2005
Thanks for the feedback, Umer. I've passed it along. I should have more information for you next week. - Anonymous
June 05, 2005
I have my vs2005 beta2 installed in the "F:program files" directory, unfortunately the avalon installer cannot install visual studio templates there and now I'm stick with working avalon projects that I cannot change and I cannot create new ones since VS doesn't understand "Add new item" -> xaml files.
I had the same problem with beta 1, but I thought it would have been fixed by now :-[.
No I have to reinstall the whole OS to get avalon working on C: drive. - Anonymous
June 05, 2005
Thanks and glad to see that u r so open to feedback :)
Umer - Anonymous
June 06, 2005
Hi,
I was wondering what happened to the Begun and Ended events of the Timeline class in this release. Are they deprecated or simply missing from the build? Is there a substitute?
Thanks,
Ælij. - Anonymous
June 13, 2005
aelij,
Begun and Ended have been replaced with a single CurrentStateInvalidated event. Similarly, Changed is now CurrentTimeInvalidated and SpeedChanged is now CurrentGlobalSpeedInvalidated.
However, the Paused, Resumed, Repeated, Reversed, and Seeked events are eliminated without a replacement. Since interactive events are called directly, you can anticipate and perform whatever actions are needed. And instead of using the Reversed event, you can use CurrentGlobalSpeedInvalidated and wait for CurrentGlobalSpeed to change sign.
These changes apply to Clock and Timeline. I hope that helps! - Anonymous
June 13, 2005
Umer, I've got good news! The Avalon team had meant to allow the simpler syntax (without parentheses) and have fixed the bugs preventing it. You should see the result in a post-Beta1 build. Thanks again for the feedback! - Anonymous
June 13, 2005
Rafal, I've let the team know about the installation bug you've encountered. Thanks for the feedback!