C# 图像动画,当它';它满了

C# 图像动画,当它';它满了,c#,xaml,windows-phone-7,windows-phone-8,C#,Xaml,Windows Phone 7,Windows Phone 8,我有一个带有图像控件和绑定源的列表框 我想要的:加载图像时(我想是ImageOpened事件?),将不透明度属性从0设置为100。Som应用程序,如Facebook,使用这种效果 图像控件位于DataTemplate中,有许多listbox项 如何解决 另外,我尝试为图像控件创建触发器,在ImageOpen事件后更改不透明度属性,但应用程序在调试器中没有显示任何原因而被粉碎。您可以首先将图像不透明度设置为零,并将图像打开的处理程序附加到一个不透明度的动画处理程序 <DataTemplate

我有一个带有图像控件和绑定源的列表框

我想要的:加载图像时(我想是ImageOpened事件?),将不透明度属性从0设置为100。Som应用程序,如Facebook,使用这种效果

图像控件位于DataTemplate中,有许多listbox项

如何解决


另外,我尝试为图像控件创建触发器,在ImageOpen事件后更改不透明度属性,但应用程序在调试器中没有显示任何原因而被粉碎。

您可以首先将图像
不透明度设置为零,并将
图像打开的
处理程序附加到一个
不透明度
的动画处理程序

<DataTemplate>
    <Image Source="{Binding}" Opacity="0" ImageOpened="OnImageOpened"/>
</DataTemplate>
数据模板:

<DataTemplate>
<Image Source="{Binding}" Opacity="0" ImageOpened="image_ImageOpened"/>
</DataTemplate>

非常感谢。我第一次也是这样做的,但是我在SetTargetProperty中犯了一个错误,并且在那里出现了NullRefException。非常感谢:)
<DataTemplate>
<Image Source="{Binding}" Opacity="0" ImageOpened="image_ImageOpened"/>
</DataTemplate>
<phone:PhoneApplicationPage.Resources>
    <Storyboard x:Name="Storyboard1">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="image">
            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
</phone:PhoneApplicationPage.Resources>
 private void image_ImageOpened(object sender, System.Windows.RoutedEventArgs e)
 {
     Storyboard1.Begin();
 }