Cant drag and move a WPF Form

Jawahar BABU picture Jawahar BABU · Nov 19, 2009 · Viewed 21.9k times · Source

I design a WPF form with Window Style=None. So I Cannot see the drag bar in the form. How can I move the Form with WindowStyle=None Property?

Answer

user278295 picture user278295 · Feb 21, 2010

I am using a main window to hold pages (creating a navigation style program), and in the code behind of my main window, I inserted this...

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
    base.OnMouseLeftButtonDown(e);

    // Begin dragging the window
    this.DragMove();
}

... and it works like a charm. This is with windowstyle=none. Its nice in the sense that you can click anywhere on the app and move it instead of just being limited to a top bar.