Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8694659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:50:14+00:00 2026-06-13T00:50:14+00:00

I am trying to use manipulation on a UI element (rectangle) and can rotate

  • 0

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).

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.

I think I somehow must find a suitable composite transform center Point to provide to ellipse but I can not figure out how.

Here is corresponding sample 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;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:50:15+00:00Added an answer on June 13, 2026 at 12:50 am

    OK. I understood it better now and found the solution. It is all about the center point of the composite transform (as I initially guessed). For center of the ellipse, I had to feed the center of rectangle. However the coordinate needed to be given relative to the ellipse. In my case ellipse is at the right upper corner of the rectangle so below is what I have given as composite transform center.

    Point centerE = previousTransformE.TransformPoint(new Point(-rectMy.Width / 2 + ellipseMy.Width / 2, rectMy.Height / 2 + ellipseMy.Height / 2));
    

    For rectangle, the center point for composite transform was:

    Point center = previousTransform.TransformPoint(new Point(rectMy.Width / 2, rectMy.Height / 2));
    

    Stackoverflow does not allow me to post an image to better visualize the things. Sorry!

    The whole code:

    previousTransform.Matrix = transformGroup.Value;
    previousTransformE.Matrix = transformGroupE.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.TranslateX = e.Delta.Translation.X;
    compositeTransform.TranslateY = e.Delta.Translation.Y;
    
    Point centerE = previousTransformE.TransformPoint(new Point(-rectMy.Width / 2 + ellipseMy.Width / 2, rectMy.Height / 2 + ellipseMy.Height / 2));
    compositeTransformE.CenterX = centerE.X;
    compositeTransformE.CenterY = centerE.Y;
    
    compositeTransformE.Rotation = e.Delta.Rotation;
    compositeTransformE.TranslateX = e.Delta.Translation.X;
    compositeTransformE.TranslateY = e.Delta.Translation.Y;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use Pixastic JavaScript library for image manipulation in Windows 8
I have been trying to use Prototype to do some DOM manipulation, but I
I'm trying to wrap my head around Javascript's function.apply(). You use it like this:
I'm trying to use manipulation to rescale a canvas. On debugging the below code
I am trying to write a pure C++ tar file manipulation library. Can one
I'm trying to use JavaScriptCore to do some string manipulation from the terminal, but
I am trying to use the jquery UI tab feature from the link http://jqueryui.com/demos/tabs/manipulation.html
i'm trying use facebook API to upload photo in my fan page. I downloaded
I am trying use gem tire to search in my application. I have tables
I was trying use a set of filter functions to run the appropriate routine,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.