WPF设置动画在控件载入时就立刻执行

 1 <YourControl.Triggers>
 2     <EventTrigger RoutedEvent="YourControl.Loaded"><!--这里是关键-->
 3         <BeginStoryboard>
 4           <Storyboard>
 5             <DoubleAnimation Storyboard.TargetProperty="Width" From="0" To="150" Duration="0:0:5" />
 6             <DoubleAnimation Storyboard.TargetProperty="Height" From="0" To="100" Duration="0:0:5" />
 7           </Storyboard>
 8         </BeginStoryboard>
 9     </EventTrigger>
10 </YourControl.Triggers>
View Code

 

posted @ 2015-11-11 11:51  一菲聪天  阅读(667)  评论(0编辑  收藏  举报