1
考虑任何列表控制下的DataTemplate:动画 “this” 和 “其他” 在WPF
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
及以下的动画:
<Window.Resources>
<Storyboard x:Key="animExpand">
<DoubleAnimation Storyboard.TargetProperty="Width" To="400" Duration="0:0:1" />
<DoubleAnimation Storyboard.TargetProperty="Height" To="400" Duration="0:0:1" />
</Storyboard>
<Storyboard x:Key="animCollapse">
<DoubleAnimation Storyboard.TargetProperty="Width" To="0" Duration="0:0:1" />
<DoubleAnimation Storyboard.TargetProperty="Height" To="0" Duration="0:0:1" />
</Storyboard>
</Window.Resources>
现在,我们希望:所有的TextBlocks的获得点击时, “animExpand”适用于它和全部其他 TextBlock有一个“animCollapse”。
第一部分很简单(触发器会这样做),但问题是如何使其他元素参与这种情况?