Change the width / height of a grid column / storyboard animation in the Windows Store app

I am looking for some method to change the width of a grid column (or row height) using the animation defined in the Storyboard . I already found some solutions for WPF applications, but they are useless in case of programming Windows Store, for example:

Grid mesh that changes width during animation

how to change grid line height in wpf using storyboard

http://www.codeproject.com/Articles/18379/WPF-Tutorial-Part-2-Writing-a-custom-animation-cla

Is it possible to get such a result by creating your own class that inherits from Timeline? If so, which components should be redirected for proper implementation?

+4
source share
2 answers

You should be able to use simple DoubleAnimation . Be sure to set EnableDependentAnimation=True , as shown below here .

One thing to understand when trying to figure out is ColumnDefinitions - GridLength struct . You can find more information about them here . You will need to configure the animation for the Value property.

+2
source

Here is an example method for animating a Grid ColumnDefinition MaxWidth.

  private void Animate(ColumnDefinition column) { Storyboard storyboard = new Storyboard(); Duration duration = new Duration(TimeSpan.FromMilliseconds(500)); CubicEase ease = new CubicEase { EasingMode = EasingMode.EaseOut }; DoubleAnimation animation = new DoubleAnimation(); animation.EasingFunction = ease; animation.Duration = duration; storyboard.Children.Add(animation); animation.From = 1000; animation.To = 0; animation.EnableDependentAnimation = true; Storyboard.SetTarget(animation, column); Storyboard.SetTargetProperty(animation, "(ColumnDefinition.MaxWidth)"); storyboard.Begin(); } 
+2
source

Source: https://habr.com/ru/post/1487764/


All Articles