Moving Silverlight 2 Popups

We are using pop-ups in a Silverlight 2 application; they can be moved in the standard way by clicking and dragging on the title bar. If the title bar is taken out of the Chrome browser, the window can no longer move.

We have users looking at this issue and I was wondering if there might be another way to allow the window to move when they are stuck behind chrome.

Or it might be better to prevent any part of the popup from coming out of the window.

+1


source to share


4 answers


After digging around, I found that there is no standard drag-and-drop mechanism for pop-ups, but a colleague has implemented it. It was easy to extend the code to restrict the popup in the host window. This is acting a little odd. Slow and smooth dragging allows the popup to move right up to the edge of the host window, but a quick drag will drag it to stop it before reaching the edge. Still trying to figure out why this is so.



+1


source


Mouse movements are reported at discrete time intervals. That is, the faster you move the mouse, the further you communicate the location of the mouse. Dragging the mouse quickly from inside to inside outside the window can report the position inside the window (PointA), and the next report will be outside the window (PointB). If you use the CaptureMouse call while dragging, you can still get mouse position reports while the pointer is outside the host window. When you find that you have moved outside the window, you can assume that the mouse is at the edge of the window. That is, if you were to draw an imaginary line from PointA to PointB, you can assume that your last point is where this line crossed the window border. If you are not using MouseCapture or using a windowless plugin I don't thinkthat you will see mouse events when you drag outside the window. In this case, estimating the position where the mouse crossed the window border is more difficult.



+2


source


The best way to deal with this is to prevent the user from moving outside the browser window. To do this, you can get the width and height of the Silverlight control . Once you have this information, you can check the position of the window when the user drags it and prevents them from moving out of the window.

0


source


maybe because the Mouse_Leave event is firing?

0


source







All Articles