Note that there are some explanatory texts on larger screens.

plurals
  1. POWinRT UI element to follow another during manipulation
    text
    copied!<p>I am trying to use manipulation on a UI element (rectangle) and can rotate and translate it without problem. What I would like to achieve is to make another UI element (ellipse for example) to follow the first (rectangle).</p> <p>If I apply the same transform group -that I used for rectangle- to ellipse, during translation manipulation it works fine but during rotation ellipse does not follow rectangle.</p> <p>I think I somehow must find a suitable composite transform center Point to provide to ellipse but I can not figure out how.</p> <p>Here is corresponding sample code.</p> <pre><code> public MainPage() { this.InitializeComponent(); rectMy.ManipulationMode = ManipulationModes.None | ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.Rotate; rectMy.ManipulationStarted += rectMy_ManipulationStarted; rectMy.ManipulationDelta += rectMy_ManipulationDelta; rectMy.ManipulationCompleted += rectMy_ManipulationCompleted; transformGroup.Children.Add(previousTransform); transformGroup.Children.Add(compositeTransform); rectMy.RenderTransform = transformGroup; } void rectMy_ManipulationCompleted(object sender, ManipulationCompletedRoutedEventArgs e) { e.Handled = true; } void rectMy_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e) { previousTransform.Matrix = transformGroup.Value; Point center = previousTransform.TransformPoint(new Point(rectMy.Width / 2, rectMy.Height / 2)); compositeTransform.CenterX = center.X; compositeTransform.CenterY = center.Y; compositeTransform.Rotation = e.Delta.Rotation; compositeTransform.ScaleX = compositeTransform.ScaleY = e.Delta.Scale; compositeTransform.TranslateX = e.Delta.Translation.X; compositeTransform.TranslateY = e.Delta.Translation.Y; } void rectMy_ManipulationStarted(object sender, ManipulationStartedRoutedEventArgs e) { e.Handled = true; } </code></pre>
 

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