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

Top 5 Contributors of the Month
Post New Web Links


Posted By:      Posted Date: October 17, 2010    Points: 0   Category :WPF

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.

View Complete Post

More Related Resource Links

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

Consequative Animations In Storyboard

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

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

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()



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

Why can't I run a storyboard triggered off of a UserControl's Unloaded event?




I’m investigating using storyboards to animate the loading and unloading of user controls (via opacity) within a content control that’s nested within our app’s main window.  This app uses Prism (v2) which manages the actual  movement of the user controls into and out of the contentcontrol “regions” so I’m focusing on using the usercontrol loaded and unloaded events to trigger the storyboards.  (I’ve also tried keying off of  Prism’s IsActive property but that doesn’t work any better.)


I’ve been successful with the storyboards launching from the Loaded events but not with the Unloaded event.  The opacity of the unloading user control never changes. 

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