nature_net.user_controls.custom_listbox.start_drag C# (CSharp) Метод

start_drag() приватный Метод

private start_drag ( System.Windows.Controls.ListBoxItem item, string username_id, System.Windows.Input.TouchDevice touch_device, ImageSource i ) : bool
item System.Windows.Controls.ListBoxItem
username_id string
touch_device System.Windows.Input.TouchDevice
i ImageSource
Результат bool
        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);
        }