Drag a WPF Form around the desktop

Grant picture Grant · May 15, 2009 · Viewed 11.9k times · Source

i am trying to make a c# WPF form where i can drag it around the screen by clicking on it and moving with the mouse. the forms characteristics include being completely transparent and containing only one image. This being said the window style is none and it is not displayed in the taskbar. So essentially all you can see when the app is running is a little image - and ideally i want to be able to drag it around the desktop if i click and hold the left mouse button and move it about.

Does anyone know a simple way i can accomplish this or have i overlooked a build in function?

Thanks.

Answer

Josh picture Josh · May 15, 2009

You can use the Window.DragMove method in the mouse down event of the window.