Click here to Skip to main content
15,939,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Using Visual Studio 08 with WPF

I'm trying to animate a button to grow to the current window size so that when the screen is resized and the button is clicked it will grow to the new size.

DoubleAnimation myDoubleAnimation = new DoubleAnimation();
myDoubleAnimation.From = 30;
int widthRange = Convert.ToInt32(Window1.ActualWidthProperty);
myDoubleAnimation.To = widthRange;
myDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(3000));
myDoubleAnimation.AutoReverse = true;

assigned this way my button dissapears
if however i say:
myDoubleAnimation.To = 300;

it works just fine

How can I set this Duration property to the current size of the main window?

1 solution

By works just fine, I mean the button is there and it grows to 300
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