动画模板的宽度和高度

时间:2012-06-07 14:07:56

标签: wpf templates size storyboard visualstates

如何在XAML中为模板的宽度和高度设置动画?例如,在下面的代码中,

<Style x:Key="myStyle" TargetType="{x:ListItem}">
<Grid x:Name="container">
<i:Interaction.Triggers>
      <i:EventTrigger EventName="TouchEnter">
             <ei:GoToStateAction StateName="Visible"/>
      </i:EventTrigger>
</i:Interaction.Triggers>
<VisualState x:Name="Visible">
      <VisualState.Storyboard>

      <Storyboard Duration="0:0:1">
          <DoubleAnimation Storyboard.TargetProperty="Width" From="200" To="400" Storyboard.TargetName="container"/>
          <DoubleAnimation Storyboard.TargetProperty="Height" From="200" To="400" Storyboard.TargetName="container"/>

      </Storyboard>

      </VisualState.Storyboard>
</VisualState>
 <!-- Other ui elements -->
</Grid>
</Style>

我可以,而不是动画“容器”网格的大小,动画整个控件的大小,即应用此样式的控件吗?由于当前方法容器的大小不会改变,这会导致剪切内容。

提前致谢。

0 个答案:

没有答案
相关问题