ViewBox (or more accurately Viewbox for those pedants playing along at home) is a nifty little convenience wrapper around scale transformations that is typically used to scale up content to fit a given area. Recently I wanted a Viewbox that animated on resize, and thus the AnimatingViewBox was born.
Essentially it allows you to specify an easing function for the resize, and a duration for the X and Y.
<Samples:AnimatingViewBox Grid.Row="1" Margin="20" ResizeXDuration="0:0:0.5" ResizeYDuration="0:0:1"> <Samples:AnimatingViewBox.EasingFunction> <BounceEase Bounces="1" Bounciness="0.6" /> </Samples:AnimatingViewBox.EasingFunction> <TextBox Text="Test" AcceptsReturn="True" BorderThickness="0" /> </Samples:AnimatingViewBox>
Or you can just use it as a drop-in replacement for the Viewbox, in which case it defaults to about 300ms for the X and Y resize, and a BackEase.
Here is the obligatory video