Dim ActualWidth As Double = LayoutRoot.ActualWidth
Dim ActualHeight As Double = LayoutRoot.ActualHeight
Dim duration As Duration = New Duration(TimeSpan.FromSeconds(1.25))
' Create two DoubleAnimations and set their properties.
Dim myDoubleAnimation1 As DoubleAnimation = New DoubleAnimation
Dim myDoubleAnimation2 As DoubleAnimation = New DoubleAnimation
myDoubleAnimation1.Duration = duration
myDoubleAnimation2.Duration = duration
Dim sb As Storyboard = New Storyboard
sb.Duration = duration
sb.Children.Add(myDoubleAnimation1)
sb.Children.Add(myDoubleAnimation2)
Storyboard.SetTarget(myDoubleAnimation1, BigImageGrid)
Storyboard.SetTarget(myDoubleAnimation2, BigImageGrid)
' Set the attached properties of Canvas.Left and Canvas.Top
' to be the target properties of the two respective DoubleAnimations
Storyboard.SetTargetProperty(myDoubleAnimation1, New PropertyPath("(Grid.Height)"))
Storyboard.SetTargetProperty(myDoubleAnimation2, New PropertyPath("(Grid.Width)"))
myDoubleAnimation1.To = ActualHeight
myDoubleAnimation2.To = ActualWidth
' Begin the animation.
sb.Begin()
|