Ejemplo n.º 1
0
        private void listViewProdutos_ItemDrag(object sender, ItemDragEventArgs e)
        {
            ListView lvSource = (ListView)sender;

            if (lvSource.Name.Equals("listViewProdutosDisponiveis"))
            {
                _ddSource = DragDropSource.ProdutosDisponiveis;
            }
            else
            {
                _ddSource = DragDropSource.ProdutosNoCorredor;
            }
            //listViewProdutosDisponiveis.DoDragDrop(lvSource.SelectedItems, DragDropEffects.Move);
            lvSource.DoDragDrop(lvSource.SelectedItems, DragDropEffects.Move);
        }
Ejemplo n.º 2
0
        //private int rowIndexOfItemUnderMouseToDrop;

        private void DataGridViewMapas_MouseMove(object sender, MouseEventArgs e)
        {
            if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
            {
                // If the mouse moves outside the rectangle, start the drag.
                if (dragBoxFromMouseDown != Rectangle.Empty &&
                    !dragBoxFromMouseDown.Contains(e.X, e.Y))
                {
                    // Proceed with the drag and drop, passing in the list item.
                    DragDropEffects dropEffect = DataGridViewMapas.DoDragDrop(
                        DataGridViewMapas.Rows[rowIndexFromMouseDown],
                        DragDropEffects.Move);
                    _ddSource = DragDropSource.Mapas;
                }
            }
        }
Ejemplo n.º 3
0
        Walkabout.Utilities.DragDropSource OnDragSource(object source)
        {
            Walkabout.Utilities.DragDropSource returnSource = null;

            ListBoxItem listBoxItemControl = WpfHelper.FindAncestor <ListBoxItem>((DependencyObject)source);

            if (listBoxItemControl != null)
            {
                Payee payee = listBoxItemControl.Content as Payee;
                if (payee != null)
                {
                    returnSource                       = new DragDropSource();
                    returnSource.DataSource            = payee;
                    returnSource.VisualForDraginSource = listBoxItemControl;
                }
            }

            return(returnSource);
        }
Ejemplo n.º 4
0
        Walkabout.Utilities.DragDropSource OnDragSource(object source)
        {
            Walkabout.Utilities.DragDropSource returnSource = null;

            ListBoxItem listBoxItemControl = WpfHelper.FindAncestor <ListBoxItem>((DependencyObject)source);

            if (listBoxItemControl != null)
            {
                Security x = listBoxItemControl.Content as Security;
                if (x != null)
                {
                    returnSource                       = new DragDropSource();
                    returnSource.DataSource            = x;
                    returnSource.VisualForDraginSource = CreateDragVisual(x);
                }
            }

            return(returnSource);
        }
Ejemplo n.º 5
0
        Walkabout.Utilities.DragDropSource OnDragDropObjectSource(object source)
        {
            Walkabout.Utilities.DragDropSource returnSource = null;

            if (IsEditing)
            {
                // turn off drag when in editing mode
            }
            else
            {
                TreeViewItem treeViewItem = WpfHelper.FindAncestor <TreeViewItem>((DependencyObject)source);
                if (treeViewItem != null)
                {
                    // First child of a TreeViewItem seems to always be a Grid in all Themes
                    FrameworkElement grid = VisualTreeHelper.GetChild(treeViewItem, 0) as FrameworkElement;
                    if (grid != null)
                    {
                        //
                        // The grid has 2 child
                        // 0 = Expander
                        // 1 = Tree Node visual
                        //
                        //
                        // We want the TreeNode visual without the Expander
                        FrameworkElement representationOfTheTreeNodeToDrag = VisualTreeHelper.GetChild(grid, 1) as FrameworkElement;
                        if (representationOfTheTreeNodeToDrag != null)
                        {
                            Category category = treeViewItem.Header as Category;
                            if (category != null)
                            {
                                returnSource                       = new DragDropSource();
                                returnSource.DataSource            = category;
                                returnSource.VisualForDraginSource = representationOfTheTreeNodeToDrag;
                            }
                        }
                    }
                }
            }

            return(returnSource);
        }