十三、“孩子”的动画——动态添加
第一步:在XAML文件中
<StackPanel x:Name="sp1" HorizontalAlignment="Left" Height="259" Margin="395,278,0,0" VerticalAlignment="Top" Width="167">
<StackPanel.ChildrenTransitions>
<TransitionCollection>
<AddDeleteThemeTransition></AddDeleteThemeTransition> //此处有好多种动画效果
</TransitionCollection>
</StackPanel.ChildrenTransitions>
</StackPanel>
第二步:在.cs文件中
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Button btn = new Button();
btn.Content = DateTime.Now;
sp1.Children.Add(btn); //动态添加按钮
}
posted on 2012-12-07 14:02 gentle_girl 阅读(211) 评论(0) 编辑 收藏 举报