This is a migrated thread and some comments may be shown as answers.

Draggable Windowless Application

0 Answers 121 Views
Window
This is a migrated thread and some comments may be shown as answers.
koray
Top achievements
Rank 1
koray asked on 23 Aug 2010, 08:31 AM
Well, my question is not related with the radwindow but I hope you guys can help :)

I have a windowless WPF application and I want it to be draggable by the users.

I can make it dragglabe by returning HTCAPTION in the WM_NCHITTEST message like this:

protected override void OnSourceInitialized(EventArgs e)
    {
        HwndSource hwndSource = (HwndSource)HwndSource.FromVisual(this);
        hwndSource.AddHook(WndProcHook);
        base.OnSourceInitialized(e);
    }
 
private static IntPtr WndProcHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handeled)
    {
        if (msg == 0x0084) // WM_NCHITTEST
        {
            handeled = true;
            return (IntPtr)2; // HTCAPTION
        }
        return IntPtr.Zero;
    }

But then, the click event of the buttons inside the application doesn't work...

-----

When I add "DragMove" to the "MouseLeftButtonDown":

this.MouseLeftButtonDown += delegate { DragMove(); };

Then the problem is, if I click one of the buttons, I get an InvalidOperationException.

User interface :)

Does anyone have something in mind for this?

No answers yet. Maybe you can help?

Tags
Window
Asked by
koray
Top achievements
Rank 1
Share this question
or