private bool start_drag(item_generic_v2 item, TouchEventArgs e)
{
if (item == null) return false;
ContentControl cursorVisual = new ContentControl();
cursorVisual.Content = item.get_clone();
cursorVisual.Style = (FindResource("CursorStyle") as Style);
List<TouchDevice> devices = new List<TouchDevice>();
devices.Add(e.TouchDevice);
foreach (TouchDevice touch in item.TouchesCapturedWithin)
{
if (touch != e.TouchDevice)
{
devices.Add(touch);
}
}
if (item.Tag == null) return false;
//string avatar = "";
//if (item.avatar.Source != null)
// avatar = item.avatar.Source.ToString();
//string data = drag_prefix + ";" + ((int)item.Tag).ToString() + ";" + avatar + ";" +
// (string)item.title.Text + ";" + item.description.Text + ";" + "" + ";" + "";
string data = drag_prefix + ";" + item.ToString();
log.WriteInteractionLog(4, "start dragging the listbox item: " + item.ToString(), e.TouchDevice);
Microsoft.Surface.Presentation.SurfaceDragCursor startDragOkay =
Microsoft.Surface.Presentation.SurfaceDragDrop.BeginDragDrop(
this._list, // The SurfaceListBox object that the cursor is dragged out from.
item, // The item object that is dragged from the drag source.
cursorVisual, // The visual element of the cursor.
data, // The data associated with the cursor.
devices, // The input devices that start dragging the cursor.
DragDropEffects.Copy); // The allowed drag-and-drop effects of the operation.
return (startDragOkay != null);
}