本文介绍了列表框幻灯片动画在新产品加入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我工作的新闻源。这将更新,每隔一段时间,如果发现新的项目,我想在从顶部起新的内容上滑动。
I am working on a news feed. This will update every so often and if new items are found, I want to slide in the new content from the top.
现在,我只是有它通过执行以下淡入:
Right now, I am just having it fade in by doing the following:
<ListBox Grid.Row="0" Height="Auto" HorizontalAlignment="Stretch" Margin="5,5,5,5" VerticalAlignment="Top" ItemsSource="{Binding NewsItems,UpdateSourceTrigger=PropertyChanged}" >
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Style.Triggers>
<EventTrigger RoutedEvent="Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
....
</ListBox>
这工作得很好,但我真的很想在项目中的幻灯片。我曾尝试一切可能的事情我能找到的,不能取得任何进展。任何帮助将是非常美联社preciated。
This works fine, but I would really like to have the item slide in. I have tried every possible thing I could find and cannot get anywhere. Any help would be much appreciated.
推荐答案
这是你要找的是什么?
<ListBox x:Name="lstBox" Grid.Row="0" Height="Auto" HorizontalAlignment="Stretch" Margin="5,5,5,5" VerticalAlignment="Top" ItemsSource="{Binding NewsItems,UpdateSourceTrigger=PropertyChanged}" >
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="LayoutTransform">
<Setter.Value>
<ScaleTransform x:Name="transform" />
</Setter.Value>
</Setter>
<Style.Triggers>
<EventTrigger RoutedEvent="Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:2" />
<DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" From="0" Duration="0:0:.2"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
这篇关于列表框幻灯片动画在新产品加入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!