private bool start_drag(ListBoxItem item, string username_id, TouchDevice touch_device, ImageSource i)
{
Image i2 = new Image();
i2.Source = i; i2.Stretch = Stretch.Uniform;
item_generic i3 = (item_generic)item.Content;
ContentControl cursorVisual = new ContentControl()
{
//Content = i2,
Content = i3.get_clone(),
Style = FindResource("CursorStyle") as Style
};
//SurfaceDragDrop.AddTargetChangedHandler(cursorVisual, OnTargetChanged);
List<InputDevice> devices = new List<InputDevice>();
devices.Add(touch_device);
foreach (TouchDevice touch in item.TouchesCapturedWithin)
{
if (touch != touch_device)
{
devices.Add(touch);
}
}
FrameworkElement element = item;
if (configurations.use_avatar_drag)
element = ((item_generic)(item.DataContext)).avatar;
SurfaceDragCursor startDragOkay =
SurfaceDragDrop.BeginDragDrop(
this._list, // The SurfaceListBox object that the cursor is dragged out from.
element, // The SurfaceListBoxItem object that is dragged from the drag source.
cursorVisual, // The visual element of the cursor.
username_id, // 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);
}