Click here to Skip to main content
16,019,087 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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...

C#
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...
Posted
Updated 25-Aug-11 20:47pm
v3

1 solution

Add a second animation that will take the panel's width back to 216 from 240, then add this to your storyboard.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900