Click here to Skip to main content
15,885,829 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All.

I have a Windows 8 Desktop App which has a WPF Window without chrome (i.e. WindowStyle="None") and I want to be able to drag it around the screen by touch not mouse.

With the mouse I would use DragMove() in a mouseDown event handler (or similar) and the magic would happen.

This doesn't work with touch as the exception "Can only call DragMove when primary mouse button is down" is thrown.

I tried handling ManipulationDelta and 'manually' moving the window by the delta amount - which 'sort of' works. the problem with this is that, having moved the window, the touch handlers send back a -ve movement to 'compensate for the change in position of the window - so the window vibrates madly as it's position is moved by +8 then -8...

It strikes me that this is something someone wold have solved before me - but I can't find a working solution in all of the interwebs (or perhaps my googling skillz are just blown!)

Anyone offer any advice (or a working example app ;)
Posted

1 solution

I had the same issue try the following
C#
private void Window_PreviewTouchDown(object sender, TouchEventArgs e)
       {
          
               this.CaptureTouch(e.TouchDevice);
         
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900