我的Windows Phone 7 Silverlight应用程序中有一些触发器,例如
<Grid x:Name="ContentGrid" Grid.Row="1" Background="Red" Height="100">
<Grid.Triggers>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:10" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Grid.Triggers>
</Grid>
但是当Loaded事件触发时,会发生XamlParseException。 我用谷歌搜索了一下,但一无所获。
有什么想法找到解决方案吗? 感谢。
答案 0 :(得分:5)
我改变了你的代码:
查看以下代码:
<Grid x:Name="ContentGrid" Grid.Row="1" Background="Red" Height="100">
<Grid.Triggers>
<EventTrigger RoutedEvent="Grid.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="Grid.Opacity">
<SplineDoubleKeyFrame KeyTim>
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:10" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Grid.Triggers>
</Grid>