开发者

Why is this animation not working?

What is wrong in this code ?

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" mc:Ignorable="d"
    x:Class="SimpleStoryBoard.MainPage"
    Width="640" Height="480">
    <UserControl.Resources>
        <Storyboard x:Name="SampleStoryboard">
            <DoubleAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransform).
(TransformGroup.Children)[0].(TranslateTransform.X)"
Storyboard.TargetName="rectangle">
                <EasingDoubleKeyFrame KeyTime="0:0:1"
Value="152.517"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransform).
(TransformGroup.Children)[0].(TranslateTransform.Y)"
Storyboard.TargetName="rectangle">
                <EasingDoubleKeyFrame KeyTime="0:0:1"
Value="27.66"/>
            </DoubleAnimationUsingKeyFrames>
            <ColorAnimationUsingKeyFrames
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="rectangle">
                <EasingColorKeyFrame KeyTime="0:0:1"
Value="#FFF11212"/>
            </ColorAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransform).
(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
Storyboard.TargetName="rectangle">
                <EasingDoubleKeyFrame KeyTime="0:0:1"
Value="1.424"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransform).
(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
Storyboard.TargetName="rectangle">
                <EasingDoubleKeyFrame KeyTi开发者_运维问答me="0:0:1"
Value="1.88"/>
            </DoubleAnimationUsingKeyFrames>
            <PointAnimationUsingKeyFrames
Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)"
Storyboard.TargetName="rectangle">
                <EasingPointKeyFrame KeyTime="0:0:1"
Value="0.809,0.202"/>
            </PointAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        <i:Interaction.Triggers>
            <i:EventTrigger>
                <ei:ControlStoryboardAction Storyboard="{StaticResource SampleStoryboard}"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
        <Rectangle Height="151" HorizontalAlignment="Left" Margin="93,86,0,0" Name="rectangle" Stroke="Black" StrokeThickness="1" VerticalAlignment="Top" Width="330">
            <Rectangle.RenderTransform>
                <CompositeTransform/>
            </Rectangle.RenderTransform>
        </Rectangle>
    </Grid>
</UserControl>

I am getting error near (UIElement.RenderTransform). (TransformGroup.Children)[0].(ScaleTransform.ScaleY) as InvalidOperationException. Cannot resolve target property

What does [0] signify in the above example?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜