I am looking a way to animate the resizing of a window, lets say that I have a window with Height=300 and Width=300, I have 2 buttons, when I click the first button the window size must change to Height=600 and Width=600 and when I click the other button the window size must back to the original size, well I can do this simply changing the Height and Width properties, but I would like to use something like Storyboard
- DoubleAnimation
to give the impression that the window size is changing gradually.
I haven't used Storyboard
- DoubleAnimation
so if anyone can give me some tips I would appreciate it.
You cannot animate two properties in parallel Below code can help you animate the Height and Width of Window named myWindow
<Button Content="Click">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard >
<Storyboard RepeatBehavior="Forever" AutoReverse="False">
<DoubleAnimation Storyboard.TargetName="myWindow"
Storyboard.TargetProperty = "(Window.Height)"
To="300" Duration="0:0:5"/>
<Storyboard RepeatBehavior="Forever" AutoReverse="False">
<DoubleAnimation Storyboard.TargetName="myWindow"
Storyboard.TargetProperty = "(Window.Width)"
To="300" Duration="0:0:5"/>
</Storyboard>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>