.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Consequative Animations In Storyboard

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :WPF
I want to make animations in storyboard consequative, not parallel so that one starts after the other ends. I will then change duratins of individual animations so using Begin attribute is not an option..NET guy

View Complete Post

More Related Resource Links

Silverlight: Create Animations with XAML and Expression Blend


In this excerpt from his upcoming book, Laurence Moroney explains the basics of Silverlight animation and the animation tools available in Expression Blend.

Lawrence Moroney

MSDN Magazine August 2008

Silverlight: Building Advanced 3D Animations with Silverlight 2.0


Animating with Silverlight is easier than you think. Here we create a 3D app that folds a polyhedron using XAML, C#, and by emulating the DirectX math libraries.

Declan Brennan

MSDN Magazine April 2008

play storyboard with dynamically created image

this is my storyboard:   <Storyboard x:Key="expandStoryboard"> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="2" Duration="0:0:0.2" /> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="2" Duration="0:0:0.2" /> </Storyboard> <!-- This storyboard will make the image revert to its original size --> <Storyboard x:Key="shrinkStoryboard"> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="0:0:0.2" /> <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="0:0:0.2" /> </Storyboard>   and i created image dynamically:   BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.UriSource = new Uri("file:///" + arrstrFileNames[0].Replace("\\", "/")); bmp.EndInit(); Image img = new Image(); img.Source = bmp; RotateTransform rt = new RotateTransform(); img.LayoutTransform = rt; ScaleTransform st = new ScaleTransform(); st.ScaleX = 1; st.ScaleY = 1; img.LayoutTransform = st; if(first==true) img.ContextMenu = mnu; first = false; assignEv

Mix'n'Match Animations

Hi, I have a storyboard written in C# (not XAML) which I use to manipulate some WPF controls - this works fine. But, I wish to manipulate objects in a ViewPort3D using the same storyboard just so all my transitions are contained in a single object. Unfortunately, I have not been able to pull this one off and rather than adding the animation to the storyboard, I have to call BeginAnimation() on the 3D component I want to animate seperately since it doesn't animate when I keep the animations together... not ideal . Is there any reason why I can't do this - storyboards written in XAML seem to pull this one of fine but C# is another story This is what I do but I want to put it in a storyboard, and yes I use the Storyboard.SetValue() for the Target and TargetProperty values. var moveCameraPositionAnimation = new Point3DAnimation() { From = new Point3D(0, 0, 0.5), To = new Point3D(0, 0, 1.2), AutoReverse = true, Duration = TimeSpan.FromMilliseconds(500) }; _focusedViewPort.Camera.BeginAnimation(ProjectionCamera.PositionProperty, moveCameraPositionAnimation); Cheers!

Unusually smooth lag occurring during WPF animations

My problem is simple and can be illustrated in 5 minutes (probably less if you frequently use WPF) of coding:  Create a WPF window (3.0/3.5/maybe 4.0).  Put a grid on it, and put a rectangle in the grid.  Implement code to make one of the rectangles follow the mouse cursor on the (window's or grid's) MouseMove event by setting the rectangle's Margin or RenderTransform.  Everything looks nice when it runs. Now add a second object to the grid that can animate (either another rectangle, or even a button that uses the aero theme because the blue glowing is handled through animations).  Do something so that the second object animates continuously.  Now run it again.  The first rectangle lags the mouse cursor by a substantial amount when the animation is occurring.  If the animation lasts for a short amount of time (< 500ms), then the lag stops immediately after the animation ends.  If the animation lasts for a long time, then there is a delay between when the animation stopped and when the lag stopped.  Sometimes this extra delay lasts for a very long time (> 10 sec). I have asked people more knowlegable than myself, and I have spent a lot of time on google looking for information.  I want to know if anyone can explain these effects.  An easy fix would be to not use animations where this would be a problem, but

Jerky animations caused by closing windows


I've got an animation running on the main window (only window) of my WPF application. The problem is that this animation isn't running smoothly.

This animation was constructed in a separate, empty project and worked perfectly (nice and smooth) until I transferred it to my main application. Now you're probably thinking what is the application doing that is interrupting the dispatcher and slowing down the rendering of the animation?

Turns out that the application isn't doing anything. Through a process of elimination (commenting out large chunks of code) I've narrowed the problem down to the creation of my splashscreen. Seems that if I create a window (the splashscreen is a normal WPF window), display it for a couple of seconds, close it and then display my main window, the animation on the main window is jerky. If I take the splashscreen out of the equation the animation is rendered smoothly.

So, why does opening and closing another window before showing my main window cause the main windows animation to shudder?

I've reproduced the problem in a small demo that can be downloaded here 

Cannot translate an object after executing a storyboard




I cannot translate an object after the same object has been translated via a storyboard.


Here is the sample code:


<Window x:Class="WpfApplication1.MainWindow"
    Title="MainWindow" Width="400"<

Storyboard.Completed firing incorrectly?


I'm using visual states to control a block of text, and I'm having difficulty trapping when the storyboard is completed.

What I want to do is change the text contents when (and only when) the text is down and out of view.

Following the trace of my application, the Storyboard.Completed and VisualStateManager.CurrentStateChanged events are both firing twice at the *beginning* of the animation!

Here is the relevant XAML code:

<VisualStateGroup x:Name="StatusText">
		<VisualTransition GeneratedDuration="0:0:0.4"/>
	<VisualState x:Name="StatusUp">
		<Storyboard Completed="StatusText_UpCompleted">
				<EasingDoubleKeyFrame KeyTime="0" Value="12"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
				<EasingDoubleKeyFrame KeyTime=&q

How do you set Storyboard.HandoffBehavior in C#?


How do you set Storyboard.HandoffBehavior in C# so that a second animation picks up where a first left off?

I am trying to use two storyboards, one after the other. HandoffBehavior has NO effect either value. The element ALWAYS resets to orginal, then animates. Can't just pickup where the first animation left off.

I simply want to DoubleAnimationUsingPath with an arcsegment twice to go from 6 o'clock to 9 o'clock, then 9 o'clock to 12 o'clock.

FillBehavior = HoldEnd is working as the element stays in place at 9 o'clock, but then resets to 6 o'clock upon Storyboard.Begin(), then animates on the desired path, but ends at 3 o'clock from 6 o'clock again, not at 12 o'clock from 9.

Any help would be appreciated.

Creating a fly up Storyboard on a stackpanel


Basically i have a few buttons in a stackpanel on the bottom of the page and when my mouse is over them i want the buttons to gradually come up.

Anyone know how to achieve this?

This is what i have tried

<StackPanel x:Name="ControlsStackPanel" Grid.Row="5" Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Orientat

How to begin storyboard based on ListBoxItem selection???

0 down vote favorite

I encounter a problem that I cannot solve. I hope to find an answer here. I need a listbox to hide half way when a certain listboxitem is selected. I setup a storyboard with opacity mask animation which work fine in blend. My problem I cannot initiate BeginStoryboard. I tried numerous ways and no success. I need to hide the listbox to reveal the content behind it. I generate listboxitems from XML data file and based on the name node I planned to initiate storyboard playing.

Here what I have. I created DataTemplate which I set via Setter in ListBoxItem Style:

<DataTemplate x:Key="SelectedListBoxItemDataTemplate">
			<StackPanel x:Name

Embedding Flash animations in a Asp.net Page...


Hi...I just wanted to insert flash animations into a page using Asp.net....

For ex. Like this website....http://axaratech.com/

Kindly advise me the simplest technique for enbedding flash in to asp.net page.

And on clicking a that particular flash , it should be redirected to another suitable page....


Thanks in advance......

How to Use Storyboard.SetTargetProperty in WPF? I think It's diffrent another animation...


Hello, glad to see U

I have a question How to use the Storyborard.SetTargetProperty... I need some help : (


I made this code (view2 is Viewbox Control), It's a example



double w2 = 200;

double h2 = 200;

DoubleAnimation daW = new DoubleAnimation(w2, TimeSpan.FromMilliseconds(100)) { FillBehavior = FillBehavior.HoldEnd };

DoubleAnimation daH = new DoubleAnimation(h2, TimeSpan.FromMilliseconds(100)) { FillBehavior = FillBehavior.HoldEnd };

view2.BeginAnimation(Viewbox.WidthProperty, daW);

view2.BeginAnimation(Viewbox.HeightProperty, daH);




double tempX = -50;

double tempY = -80;

DoubleAnimation daX = new DoubleAnimation(tempX, TimeSpan.FromSeconds(0.1)) { FillBehavior = FillBehavior.HoldEnd };

DoubleAnimation daY = new DoubleAnimation(tempY, TimeSpan.FromSeconds(0.1)) { FillBehavior = FillBehavior.HoldEnd };

v2.RenderTransform.BeginAnimation(TranslateTransform.XProperty, daX);

v2.RenderTransform.BeginAnimation(TranslateTransform.YProperty, daY);



I want conbine all codes, so I made a st

Is this a BUG?(Storyboard + database search + Storyboard = badly delayed animation)(Cannot run a sto

//push a button play the first storyboard animation : ListView fade-out

private void image4_MouseDown(object sender, MouseButtonEventArgs e)


   Storyboard sb2 = (Storyboard)this.FindResource("daychange_Copy1") as Storyboard;

   sb2.Completed += new EventHandler(sb_Completed);



//when the first animation is end, get data from database , fill the ListView and play the second storyboard animation

void sb_Completed(object sender, EventArgs e)


   getlist();//get data from database , fill the ListView

   Storyboard sbkk = (Storyboard)this.FindResource("daychange_Copy2") as Storyboard;



//get data from database , fill the ListView

private void getlist()





Hi all

           I just came across this task, i need your help on this. I have a story board which is like this

<Storyboard x:Key="RightLeft" x:Name ="rightToLeftStoryBoard"><DoubleAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior ="Forever" Storyboard.TargetProperty="(UIElement.

How to go back after use Storyboard(move) ?



I made a button, It looks like the 'IPhone' setup button.

[    O]    ->  [ |     ]


and I make two storyboards. one is move right 100 pixel (X Property), and another is move back original Position.

1)   O                          [Init]    

2)               O              [storyboard1], move X +100

3)   O                          [storyboard2], move X 0


but 2) button position was not hold on.

so I used 'Fillhavior = Stop' and 'Storyboard1.Completed += EventFunc'.

EventFunc { O.renderTransform = new TranslateTransform(100, 0); }

It's so good. but I know that I have a problem.



It's a 'storyboard2 problem'..... It has an error, I think It's not same Position when EventFunc finished !!



plz help me, how to use rectang

Animations - More than one target


Hey guys,

i tried to migrate a website to asp.net. For this old website i used animations with php and jquery.
Now i tried to do everything of this animations with the ajax control kit but i have no clue how.

Imagine i have a div-container ("ContentBox") in which is a div container with the navigation ("Nav") and one with the content ("Content").  Further the ContentBox has a background image.

What i have done on the old page was to fade out the Content-container, changed the color of ContentBox to black (to change the image without coverage) and fade back in the image and the new content. Everything of this happens onClick on a link in the Nav-Container.

Is this possible in asp.net?
1 OnClick-Event but a few divs to be affected?

Thanks a lot.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend