【发布时间】:2010-09-27 08:20:14
【问题描述】:
考虑在任何列表控件中遵循 DataTemplate:
<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>
现在我们想要:当任何一个 TextBlock 被点击时,“animExpand”应用到它并且所有 other TextBlock 都有一个“animCollapse”。
第一部分很简单(触发器可以做到),但问题是如何让 其他 元素参与到这个场景中?
【问题讨论】: