WPF Animation
I built a feature to have an animation on the wide of a panel and the user click the minimize button. I wish to create a shrinking effect.
The best way I found is using DoubleAnimationUsingKeyFrames. This kind of animation can targeting any properties which is using a double as its value, such as Wide. Finally, I put the into a storyboard. Like the following
Code
DoubleAnimationUsingKeyFrames da = new DoubleAnimationUsingKeyFrames(); | |
LinearDoubleKeyFrame ad3 = new LinearDoubleKeyFrame(); | |
ad3.KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0)); | |
ad3.Value = ActualWidth; | |
LinearDoubleKeyFrame ad = new LinearDoubleKeyFrame(); | |
ad.KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0,0,6)); | |
ad.Value = 0; | |
Storyboard strbStoryboard = new Storyboard(); | |
strbStoryboard.Children.Add(da); | |
Storyboard.SetTargetProperty(da, new PropertyPath("(FrameworkElement.Width)")); | |
Storyboard.Begin(this); |
The example is from my opensource project, advgen contact manager
Trackback address for this post
Trackback URL (right click and copy shortcut/link location)
Feedback awaiting moderation
This post has 751 feedbacks awaiting moderation...
Form is loading...