写了一个使用代码创建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();
}