3
我正在构建Windows应用商店应用(Winrt,Metro,Windows 8应用)。我尝试在gridview动画中提供图片:图片从网页加载并打开后填充其单元格。在Windows 8中重复使用动画
我有故事板为:
<Storyboard x:Name="PopupImageStoryboard">
<DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="image">
<EasingDoubleKeyFrame KeyTime="0" Value="100"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="240"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames EnableDependentAnimation="True" Storyboard.TargetProperty="(FrameworkElement.Height)" Storyboard.TargetName="image">
<EasingDoubleKeyFrame KeyTime="0" Value="100"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="240"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
而且我有这样的C#代码处理事件的图像加载并打开:
private void Image_ImageOpened(object sender, RoutedEventArgs e)
{
Storyboard.SetTarget(PopupImageStoryboard, sender as Image);
PopupImageStoryboard.Begin();
}
它不工作,我不能改变目标和在运行时重新运行相同的故事板。但我想让多个图像同时运行这个动画。你能推荐任何动画重用的解决方案吗?也
Storyboard.TargetName="image"
那么我想一个故事板可能无法将在同一时间两个靶材元件使用,所以该解决方案:
谢谢您的回答!你能给出更多关于动画“弹出”图片的替代方法的细节,我知道动画宽度和高度并不是最好的主意。 – imslavko