2009-06-15 84 views
1

所以作为一个简单的例子,如果你有一个像下面那个动态创建它的内容的ItemsControl我怎么可以添加触发器,以便每个项目动画和有一个BeginTime基于它的索引在名单。按顺序动画ItemsControl中的项目

我试过扩展按钮,使其包含延迟时间,然后绑定按钮ControlTemplate的触发器中包含的动画的BeginTime,由于动画是可冻结的,因此存在问题。

如何在ItemsControl本身或单个项目上创建一个Storyboard,逐个显示每个项目。

任何想法?

起点为我的标记:

<Window.Resources> 
    <ResourceDictionary > 
     <Collections:ArrayList x:Key="ItemsList"> 
      <System:String>OPTIONS</System:String> 
      <System:String>STICKERS</System:String> 
      <System:String>STYLING</System:String> 
      <System:String>WHEELS</System:String> 
      <System:String>INTERIOR</System:String> 
      <System:String>ROOF</System:String> 
      <System:String>COLOURS</System:String> 
      <System:String>VERSION</System:String> 
     </Collections:ArrayList> 
    </ResourceDictionary> 
</Window.Resources> 

<Grid> 
    <ListView ItemsSource="{StaticResource ItemsList}"> 
     <ListView.Style> 
      <Style> 
       <Setter Property="ListView.ItemTemplate"> 
        <Setter.Value> 
         <DataTemplate> 
          <Button Content="{Binding}" /> 
         </DataTemplate> 
        </Setter.Value> 
       </Setter> 
      </Style> 
     </ListView.Style> 
    </ListView> 
</Grid> 

干杯 Ĵ

回答

1

有可能是没有办法通过XAML来做到这一点。

而是在您的C#代码隐藏中填充ListView,然后在代码中创建Storyboard和Trigger。一个想法是将Button扩展为具有“下一个按钮显示”字段,为您的显示动画播放故事板,然后触发下一个按钮执行相同操作,直到您到达最后一个按钮“NextButton == null”

+0

是的。我有这样的事情,但我不喜欢动画无法通过资源进行更改和维护的事实。 – 2009-06-17 08:29:40