private void Animate(TextBox target, double oldHeight, double newHeight, TimeSpan duration) { target.Height = oldHeight; DoubleAnimation animation = new DoubleAnimation(newHeight, duration); target.BeginAnimation(TextBox.HeightProperty, animation); }