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

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

private start_drag ( System.Windows.Controls.ListBoxItem item, object data, System.Windows.Input.TouchDevice touch_device, ImageSource i ) : bool
item System.Windows.Controls.ListBoxItem
data object
touch_device System.Windows.Input.TouchDevice
i ImageSource
Результат bool
        private bool start_drag(ListBoxItem item, object data, TouchDevice touch_device, ImageSource i)
        {
            Image i2 = new Image();
            i2.Source = i; i2.Stretch = Stretch.Uniform;
            item_generic i3 = null;
            try { i3 = (item_generic)item.Content; }
            catch (Exception) { }
            ContentControl cursorVisual = new ContentControl();
            if (i3 != null)
                cursorVisual.Content = i3.get_clone();
            else
                cursorVisual.Content = i2;
            cursorVisual.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;

            Microsoft.Surface.Presentation.SurfaceDragCursor startDragOkay =
                Microsoft.Surface.Presentation.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.
                  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);
        }

Same methods

custom_listbox_v2::start_drag ( collection_listbox_item img, System.Windows.Input.TouchDevice input ) : bool
custom_listbox_v2::start_drag ( item_generic_v2 item, System.Windows.Input.TouchEventArgs e ) : bool