Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi
I create user control with WPF but I can't
Calculation end point when the change form size the
Run-time animations

http://www.mediafire.com/view/79d9gacbbk716wp/4.png[^]


C#
//Set Location
ContentControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
Canvas.SetLeft(ContentControl, 3);

//Define Strat And End Animation
myDoubleAnimation1.From = 0 ;
myDoubleAnimation1.To = this.ActualWidth ;
myDoubleAnimation1.Duration =TimeSpan.FromSeconds(1);
sb.Duration =TimeSpan.FromSeconds(1);

Storyboard.SetTarget(myDoubleAnimation1, ContentControl);
Storyboard.SetTargetProperty(myDoubleAnimation1, new PropertyPath("(FrameworkElement.RenderTransform).(TranslateTransform.X)"));
 

sb.Children.Add(myDoubleAnimation1);
//Event For Finish the Animation
sb.Completed += _Completeds;

// Begin the animation.
sb.Begin();
Posted

1 solution

I don't think you can change these properties with a running animation.

You might try to stop the animation, set the properties to the new values and start again in the
private void Main_SizeChanged(object sender, SizeChangedEventArgs e)

code behind event of your window.
 
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