写了一个使用代码创建Silverlight的函数

private void PlayMainAn()
{
//增加动画
Storyboard story = new Storyboard();
DoubleAnimation doAn = new DoubleAnimation()
{
From = 405,//Canvas.GetLeft(contentControl1),
To = 10,
Duration = new Duration(TimeSpan.FromMilliseconds(300)),

};
Storyboard.SetTarget(doAn, contentControl1);
Storyboard.SetTargetProperty(doAn, new PropertyPath("(Canvas.Left)"));
story.Children.Add(doAn);
story.Begin();
}

posted @ 2011-11-05 13:44  叫什么好  阅读(207)  评论(0编辑  收藏  举报