双重动画后更改控件的属性 [英] Change the property of the control after doubleanimation
本文介绍了双重动画后更改控件的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨...
我已使用DoubleAnimation
将Panal
的宽度从24增加到240,持续了一秒钟,我想设置其宽度(240-24),即216,但是我无法做到这一点.谁能告诉我如何实现这一目标.代码在下面给出...
此.RegisterName(LeftPanel.Name,LeftPanel);
DoubleAnimation dbani = 新 DoubleAnimation();
dbani.From = 24 ;
dbani.To = 240 ;
dbani.Duration = 新持续时间(TimeSpan.FromSeconds( 1 ));
Storyboard.SetTargetName(dbani,LeftPanel.Name);
Storyboard.SetTargetProperty(dbani,新 PropertyPath(Border.WidthProperty));
情节提要myWidthAnimatedButtonStoryboard = 新情节提要();
myWidthAnimatedButtonStoryboard.Children.Add(dbani);
myWidthAnimatedButtonStoryboard.Begin(LeftPanel);
LeftPanel.width = 216 ;
谢谢...
解决方案
添加第二个动画,它将面板的宽度从240减小到216,然后将其添加到情节提要中.
Hi...
I have used the DoubleAnimation
to increase the width of a Panal
from 24 to 240 for the duration of one second after this I want to set its width (240-24) i.e 216 but I am unable to do this. Can anyone tell me how can I achieve this. the code is given below...
this.RegisterName(LeftPanel.Name, LeftPanel);
DoubleAnimation dbani = new DoubleAnimation();
dbani.From = 24;
dbani.To = 240;
dbani.Duration = new Duration(TimeSpan.FromSeconds(1));
Storyboard.SetTargetName(dbani, LeftPanel.Name);
Storyboard.SetTargetProperty(dbani, new PropertyPath(Border.WidthProperty));
Storyboard myWidthAnimatedButtonStoryboard = new Storyboard();
myWidthAnimatedButtonStoryboard.Children.Add(dbani);
myWidthAnimatedButtonStoryboard.Begin(LeftPanel);
LeftPanel.width=216;
Thanks...
解决方案
Add a second animation that will take the panel''s width back to 216 from 240, then add this to your storyboard.
这篇关于双重动画后更改控件的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文