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

  • SEARCH
  • Home
  • 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 7530961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:03:21+00:00 2026-05-30T05:03:21+00:00

I would like to draw a simple circle and move it to the defined

  • 0

I would like to draw a simple circle and move it to the defined position on X,Y axis by coding.

For example;

There will be 2 buttons on WPF window and there will be a circle on 0,0(x,y). When I clicked on the 1st button, it will go to X = 150 and Y= 40. But the shape has to go there smoothly. I mean I dont want it to be disapear at the current position and appear on the defined position. I want it to go there. How should I do this? Can you explain me the steps? and if possible some example code ?

UPDATED CODE:

    int X = 0;
    int Y = 0;

    public bool inside = true;

    private void Button_Click_1(object sender, RoutedEventArgs e)
    {

        if (inside)
        {
            DoubleAnimation animatex = new DoubleAnimation();
            animatex.To = X++;
            // animatex.Duration = new Duration(TimeSpan.FromSeconds(1));
            // animatex.RepeatBehavior = RepeatBehavior.Forever;
            el.BeginAnimation(Canvas.LeftProperty, animatex);

            DoubleAnimation animatey = new DoubleAnimation();
            animatey.To = Y++;
            // animatey.RepeatBehavior = RepeatBehavior.Forever;
            el.BeginAnimation(Canvas.TopProperty, animatey);
        }
    }
  • 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-05-30T05:03:23+00:00Added an answer on May 30, 2026 at 5:03 am

    xaml is something like
    <Canvas>
    <Ellipse Width="10" Height="10" Canvas.Left="0" Canvas.Top="0" Fill="Black" x:Name="el"/>
    </Canvas>

    Click event of button is something like this

    enter image description here

    Hope this will work. I have tried it and it worked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to draw lines (of arbitrary position and length) onto a surface
I would like to learn about creating a program that I could draw simple
I am using MS Chart Control to draw simple 2D chart. I would like
I would like draw a vector-based graphic within a WPF ListBoxItem. The 2D shapes
I would like to draw an NSImage in a NSView drawRect in a simple
I would like to draw some shapes on a JPanel by overriding paintComponent .
I would like to draw a chart in OpenGL similar to the donut graph
in vb.net i would like to draw a regular line on a form. is
In C# i have a picturebox. i would like to draw 4 colors. The
I would like to use Cocos2d on the iPhone to draw a 2D car

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.