Silverlight 4.0 为什么这个动画不起作用?
这个代码有什么问题Silverlight 4.0 为什么这个动画不起作用?,silverlight-4.0,Silverlight 4.0,这个代码有什么问题 <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.openx
<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 KeyTime="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>
我在(UIElement.RenderTransform)附近遇到错误。
(TransformGroup.Children)[0]。(ScaleTransform.ScaleY)
作为InvalidOperationException。无法解析目标属性
在上面的示例中,
[0]
表示什么?该[0]
是集合属性的索引。@slugster:-哪个集合?是网格中的子元素集合,还是确切的子元素集合?您能修复上面代码中的错误吗?@TCM您找到解决方案了吗?[0]
是集合属性的索引。@slagster:-哪个集合?是网格中的子元素集合,还是确切的子元素集合?您能修复上面代码中的错误吗?@TCM您找到解决方案了吗?