Thanks. I found what I wanted in the Dispatcher class (which class Application uses). I needed to see more than I thought, because there is so much important code, however, what I originally was looking for was basically the following in Dispatcher.PushFrameImpl():
Where did you tell me everything what Application.Run() does and how it does it? If you can't understand my question or don't know the answer to my question, then I would like an answer from someone who does.
I told you where to find the information. Whatever that method does is internal to Microsoft, so they are the people to answer the question. What you have still not done, is to explain exactly what problem (if you actually have one) you are trying to solve.
I'm trying to drag a user control around a canvas. I want to prevent the user from dragging the control outside the canvas.. See my comment in green.
private void Control_MouseMove(object sender, MouseEventArgs e)
var draggableControl = sender as UserControl;
if (isDragging && draggableControl != null)
Point currentPosition = e.GetPosition(this.Parent as UIElement);
var transform = draggableControl.RenderTransform as TranslateTransform;
if (transform == null)
transform = new TranslateTransform();
draggableControl.RenderTransform = transform;
// Problem: currentPosition is the distance from the window's Left edge,
// not the left edge of the canvas
var newX = currentPosition.X - clickPosition.X;
if (newX < 0)
newX = 0;
if (newX > parent.ActualWidth)
newX = parent.Width - this.Width;
transform.X = newX;
transform.Y = currentPosition.Y - clickPosition.Y;
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
I describe, is the Edge Browser window tab, drag and drop out to generate a new form, the drag process mouse followed by a label image. What can I do to achieve a similar drag-and-drop operation?
What can I do to achieve the following functions, do you really want to use the mouse hook, Microsoft itself should not be in the UWP program to use Win32 things.
The main thing is that WPF mouse-moving event cannot be triggered outside the window.
The way to handle this is to have the window itself act as the drop target. When the DragLeave[^] event is raised, create a new Window and add that tab into that window. There's a lot of code that you're going to have to write here - when I've done it, I've written it for clients so they own that code so I can't share it with you. You can see from this what you need to do so you should be able to cope with the actual mechanics of it yourself.
This space for rent
Last Visit: 18-Aug-19 15:31 Last Update: 18-Aug-19 15:31