You can always create an attached property for a height that does nothing but set the height property in the target control, so you can animate it using the To function in your attached property.
public class AnimatedPanelBehavior { public static double GetAnimatedHeight(DependencyObject obj) { return (double)obj.GetValue(AnimatedHeightProperty); } public static void SetAnimatedHeight(DependencyObject obj, double value) { obj.SetValue(AnimatedHeightProperty, value); } public static readonly DependencyProperty AnimatedHeightProperty = DependencyProperty.RegisterAttached("AnimatedHeight", typeof(double), typeof(AnimatedPanelBehavior), new UIPropertyMetadata(0d, new PropertyChangedCallback((s, e) => { FrameworkElement sender = s as FrameworkElement; sender.Height = (double)e.NewValue; }))); }
Then, to revive it, you would use the usual animation, just try it now, and it works fine, but I have not explored it further than "it works".
<DoubleAnimation Storyboard.TargetProperty="(local:AnimatedPanelBehavior.AnimatedHeight)" To="100" Duration="0:0:5"/>
use AnimatedHeight instead of height to whatever you want to animate.
source share