I would like to create dynamic Translate Y animations for my grids, but I can't find how to do it in UWP programmatically.
I have this code, but it says
WinRT information: Cannot resolve TargetProperty TranslateY on specified object.
I have tried to set property name to Y, but it says:
WinRT information: Cannot resolve TargetProperty Y on specified object.
Sample:
private void CreateStoryBoardAnimation(Grid myGrid)
{
myGrid.RenderTransform = new CompositeTransform();
Storyboard storyboard = new Storyboard();
DoubleAnimation translateYAnimation = new DoubleAnimation();
translateYAnimation.From = -500;
translateYAnimation.To = 1;
translateYAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(500));
Storyboard.SetTarget(translateYAnimation, myGrid);
Storyboard.SetTargetProperty(translateYAnimation, "TranslateY");
storyboard.Children.Add(translateYAnimation);
storyboard.Begin();
}
I have also tried to use TranslateTransform class... But I don't get how could i use it.
Storyboard.SetTargetProperty only accepts a string in UWP.
I would like to move my grid on screen with animation. I know how to make a storyboard animation in blend, but that is not an option in this case.