Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Drag and Drop with Touch and Windows 8.1

$
0
0

There seems to be a problem when using DoDragDrop on Windows 8.1 and a WPF C# app. To keep it simple I used the code example from this post Drag-and-Drop with Touch on Windows 7 and am not having the same results as on Windows 7.

The Drop event will not fire at all until changing the code to handle TouchMove instead of TouchDown. What I end up with is the following :

<StackPanel><LabelContent="StackOverflow"HorizontalAlignment="Center"TouchMove="Label_TouchMove"/><LabelContent="Drag to here"HorizontalAlignment="Center"AllowDrop="True"Drop="Label_Drop"/></StackPanel>// Drag sourceprivatevoidLabel_TouchMove(object sender,TouchEventArgs e){Label l = e.SourceasLabel;DragDrop.DoDragDrop(l, l.Content+" was Dragged!",DragDropEffects.Copy);}// Drag targetprivatevoidLabel_Drop(object sender,DragEventArgs e){string draggedText =(string)e.Data.GetData(DataFormats.StringFormat);Label l = e.SourceasLabel;
    l.Content= draggedText;}

But now an extra TouchMove is fired after the drag is completed. I can find no reason for this to happen.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>