Freigeben über


Expression Blend 4 - XAML generation tweaks

With Blend 4, we have made a number of significant changes to how we generate XAML, primarily with the aim of generating more compact XAML. You will find a couple of these interesting:

a) DoubleAnimation v/s DoubleAnimationUsingKeyframes
In Blend 3, rotating a Rectangle in a Storyboard would give you the following:
<Storyboard x:Name="Storyboard1">
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="rectangle" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
        <EasingDoubleKeyFrame KeyTime="00:00:00" Value="15.091"/>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

In Blend 4, you now get the following (Note that you will find the user experience identical between Blend 3 and Blend 4 - if you were to drop an additional key frame, we will convert the animation to the type that lets you do keyframing)
<Storyboard x:Name="Storyboard1">
    <DoubleAnimation BeginTime="00:00:00" Duration="0:0:1.6" To="12.228" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="rectangle" d:IsOptimized="True"/>
</Storyboard>

b) TransformGroup v/s CompositeTransform
In Blend 3, rotating a Rectangle would give you the following:
<Rectangle x:Name="rectangle" Fill="White" Stroke="Black">
            <Rectangle.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform Angle="15"/>
                    <TranslateTransform/>
                </TransformGroup>
            </Rectangle.RenderTransform>
</Rectangle>

In Blend 4, you now get the following:
<Rectangle x:Name="rectangle" Fill="White" Stroke="Black">
            <Rectangle.RenderTransform>
                <CompositeTransform Rotation="15"/>
            </Rectangle.RenderTransform>
</Rectangle>

Are there any other areas where you find the XAML being generated by Blend is more verbose than that would you would have liked? If so, I would love to hear about them!