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 6683251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:47:57+00:00 2026-05-26T04:47:57+00:00

I have a wpf application with some Thumb controls which move items around a

  • 0

I have a wpf application with some Thumb controls which move items around a canvs. I want to detect when these thumbs are dragged over another element. However, the drag enter on the element which is dragged over is not fired. I know this code works as drag items that are not thumbs fire the event.

Is the drag event on the thumb not a drag event that other components listen to?

Any idea how to get this to work?

  • 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-26T04:47:58+00:00Added an answer on May 26, 2026 at 4:47 am

    To achieve the simulation of a drag enter event when a thumb object is moved over another component I’ve had to do this:

    Register event handler for the thumb drag delta

    EventManager.RegisterClassHandler(typeof(Thumb), Thumb.DragDeltaEvent, new RoutedEventHandler(Thumb_DragDeltaEvent), true);
    

    Then in the event handler see if the dragged element is over the element that is listening to the moving component

    void Thumb_DragDeltaEvent(object sender, RoutedEventArgs e)
        {
            UIElement src = e.Source as UIElement ;
            if (src != null)
            {                
                Point srcPositionTopLeft = new Point(Canvas.GetLeft(src), Canvas.GetTop(src));
                Point srcPositionBottomRight = new Point(srcPositionTopLeft.X + src.ActualWidth, srcPositionTopLeft.Y + ActualHeight);
                Rect srcRect = new Rect(srcPositionTopLeft, srcPositionBottomRight);
                Rect transformedSrcRect = src.TransformToAncestor(this.Parent).TransformBounds(srcRect);
    
                Point trgPositionTopLeft = new Point(Canvas.GetLeft(this), Canvas.GetTop(this));
                Point trgPositionBottomRight = new Point(trgPositionTopLeft.X + this.ActualWidth, trgPositionTopLeft.Y + this.ActualHeight);
                Rect trgRect = new Rect(srcPositionTopLeft, srcPositionBottomRight);
                Rect transformedTrgRect = this.TransformToAncestor(this.Parent).TransformBounds(trgRect);
    
                if (transformedSrcRect.Contains(transformedTrgRect) ||
                    transformedSrcRect.IntersectsWith(transformedTrgRect))
                {
                    //drag is over element
                }
            }
        }
    

    Remember to removed event handlers etc later.

    Hope this helps someone in the future.

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

Sidebar

Related Questions

Say we have a standard WPF-application, and I want to show some UI-elements on
In my WPF application I have a Canvas in which I do some drawing.
I have a WPF application in which a thread checks some value. In certain
I have a WPF application using MVVM. I have some user controls that show
I have a WPF application in which I'm moving data around on a Canvas.
I have a wpf application that has some shapes on a canvas I want
I have a WPF application which uses some library code for authentication which needs
I have a WPF application in VS 2008 with some web service references. For
In my WPF application I have some drawing functionality. I have solved this using
I have created some tests in my WPF application. Right now I am working

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.