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