如何为Silverlight Storyboard Begintime而不是xaml执行代码隐藏
我需要将这个xaml代码转换为begintime的代码如何为Silverlight Storyboard Begintime而不是xaml执行代码隐藏,silverlight,storyboard,translate,Silverlight,Storyboard,Translate,我需要将这个xaml代码转换为begintime的代码 <Storyboard BeginTime="0:0:10" x:Name="sbEllipse1"> <DoubleAnimation Storyboard.TargetName="myBrush1" Storyboard.TargetProperty="Radius
<Storyboard BeginTime="0:0:10" x:Name="sbEllipse1">
<DoubleAnimation
Storyboard.TargetName="myBrush1"
Storyboard.TargetProperty="RadiusX"
From="0" To="1"
Duration="0:0:20"
/>
<DoubleAnimation
Storyboard.TargetName="myBrush1"
Storyboard.TargetProperty="RadiusY"
From="0" To="1"
Duration="0:0:20"
/>
</Storyboard>
情节提要sb=新情节提要();
sb.BeginTime=从秒开始的时间跨度(10);
//上述的等效代码为:
DoubleAnimation db=新的DoubleAnimation();
db.From=0;
db.To=1;
db.Duration=新的持续时间(TimeSpan.FromSeconds(20));
故事板.SetTarget(db,myBrush1);
情节提要.SetTargetProperty(db,RadiusX);
//上述的等效代码为:
DoubleAnimation db1=新的DoubleAnimation();
db1.From=0;
db1.To=1;
db1.Duration=新的持续时间(TimeSpan.FromSeconds(20));
故事板.SetTarget(db,myBrush1);
情节提要.SetTargetProperty(db,RadiusY);
//将两个双动画指定给主情节提要
sb.儿童添加(db);
添加(db1);
myBrush1.Resources.Add(故事板);
某人开始做某事;
Storyboard sb = new Storyboard();
sb.BeginTime = TimeSpan.FromSeconds(10);
sb.Children.Add(new DoubleAnimation());
sb.Children.Add(new DoubleAnimation());
Storyboard sb = new Storyboard();
sb.BeginTime = TimeSpan.FromSeconds(10);
<DoubleAnimation
Storyboard.TargetName="myBrush1"
Storyboard.TargetProperty="RadiusX"
From="0" To="1"
Duration="0:0:20"
/>
//Equivalent code for the above is :
DoubleAnimation db = new DoubleAnimation();
db.From = 0;
db.To = 1;
db.Duration = new Duration(TimeSpan.FromSeconds(20));
Storyboard.SetTarget(db, myBrush1);
Storyboard.SetTargetProperty(db, RadiusX);
<DoubleAnimation
Storyboard.TargetName="myBrush1"
Storyboard.TargetProperty="RadiusY"
From="0" To="1"
Duration="0:0:20"
/>
//Equivalent code for the above is :
DoubleAnimation db1 = new DoubleAnimation();
db1.From = 0;
db1.To = 1;
db1.Duration = new Duration(TimeSpan.FromSeconds(20));
Storyboard.SetTarget(db, myBrush1);
Storyboard.SetTargetProperty(db, RadiusY);
//assigning both double animation to main Storyboard
sb.Children.Add(db);
sb.Children.Add(db1);
myBrush1.Resources.Add(storyboard);
sb.Begin();