Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>SOLVED IT</p> <p>The problem is in the path to the element youre using, its has to derive from the parent class its extending to the property itself. I have it working in my own control so made a small example you can copy paste(UNTESTED CODE):</p> <p><code></p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media.Animation; namespace CustomControls { /// &lt;summary&gt; /// Author: Frank Wolferink /// Note: example is untested and comes as is. I hope it save's you the time i lost figering this out /// &lt;/summary&gt; public class CustomControl : Control { private Storyboard _compositeTransformExampleStoryBoard; private const string TRANSLATE_X_TARGET = "Control.RenderTransform.CompositeTransform.TranslateX"; private const string TRANSLATE_Y_TARGET = "Control.RenderTransform.CompositeTransform.TranslateY"; private const string TRANSLATE_ROTATE_TARGET = "Control.RenderTransform.CompositeTransform.Rotation"; public CustomControl() { this.RenderTransform = new CompositeTransform(); TimeSpan duration = new TimeSpan(0,0,0,0,500); double translateX = 10; double translateY = 10; double rotation = 40; _compositeTransformExampleStoryBoard = BuildStoryboard(duration, translateX, translateY, rotation); this.Loaded += CustomControl_Loaded; } void CustomControl_Loaded(object sender, RoutedEventArgs e) { _compositeTransformExampleStoryBoard.Begin(); } private Storyboard BuildStoryboard(TimeSpan animationDuration, double transistionValueX, double transistionValueY, double rotation) { Storyboard storyboard = new Storyboard(); if (transistionValueX != 0) CreateAnimation(storyboard, transistionValueX, animationDuration, TRANSLATE_X_TARGET); if (transistionValueY != 0) CreateAnimation(storyboard, transistionValueY, animationDuration, TRANSLATE_Y_TARGET); if (rotation != 0) CreateAnimation(storyboard, rotation, animationDuration, TRANSLATE_ROTATE_TARGET); return storyboard; } private void CreateAnimation(Storyboard storyboard, double transistionValue, TimeSpan animationDuration, string targetProperty) { DoubleAnimation da = CreateDoubleAnimation(transistionValue, animationDuration); storyboard.Children.Add(da); Storyboard.SetTarget(da, this); Storyboard.SetTargetProperty(da, targetProperty); } private DoubleAnimation CreateDoubleAnimation(double transistionValue, TimeSpan duration) { return new DoubleAnimation() { Duration = duration, To = transistionValue }; } } } </code></pre> <p></code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload