private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
            details = new DropIndicationDetails();
            var listBox = e.OriginalSource as System.Windows.Controls.ListBox ?? (e.OriginalSource as FrameworkElement).ParentOfType <System.Windows.Controls.ListBox>();

            if (listBox == null || listBox.SelectedItems.Count == 0)
            {
                return;
            }
            var item = listBox.SelectedItems;

            details.CurrentDraggedItem = item;

            IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null);

            dragPayload.SetData("DraggedData", item);
            dragPayload.SetData("DropDetails", details);

            e.Data = dragPayload;

            e.DragVisual = new DragVisual()
            {
                Content         = details,
                Background      = new SolidColorBrush(Colors.Transparent),
                BorderThickness = new Thickness(0),
                ContentTemplate = Application.Current.FindResource("SecureItemsDragTemplate") as DataTemplate
            };
            e.DragVisualOffset = e.RelativeStartPoint;
            e.AllowedEffects   = DragDropEffects.All;
        }
Esempio n. 2
0
        private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
            var sourceRow = e.OriginalSource as GridViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType <GridViewRow>();

            if (sourceRow != null && sourceRow.Name != "PART_RowResizer")
            {
                DropIndicationDetails details = new DropIndicationDetails();
                var item = sourceRow.Item;
                details.CurrentDraggedItem = item;

                IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null);

                dragPayload.SetData("DraggedItem", item);
                dragPayload.SetData("DropDetails", details);

                e.Data = dragPayload;

                e.DragVisual = new DragVisual()
                {
                    Content         = details,
                    ContentTemplate = this.AssociatedObject.Resources["DraggedItemTemplate"] as DataTemplate
                };
                e.DragVisualOffset = e.RelativeStartPoint;
                e.AllowedEffects   = DragDropEffects.All;
            }
        }
Esempio n. 3
0
        private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
            DropIndicationDetails details = new DropIndicationDetails();
            //DragDropPayloadManager.GetDataFromObject(e.Data, )
            //ListBoxItem itemA = (ListBoxItem)VisualTreeHelper.GetParent(e.OriginalSource as UIElement);
            var listBoxItem = e.OriginalSource as System.Windows.Controls.ListBoxItem ?? (e.OriginalSource as FrameworkElement).ParentOfType <System.Windows.Controls.ListBoxItem>();
            // var item = listBoxItem != null ? listBoxItem.DataContext : (sender as System.Windows.Controls.ListBox).ItemsSource;

            List <ProductViewModel> item = new List <ProductViewModel>();

            item = (sender as System.Windows.Controls.ListBox).SelectedItems.Cast <ProductViewModel>().ToList <ProductViewModel>();
            if (listBoxItem != null)
            {
                item.Add(listBoxItem.DataContext as ProductViewModel);
            }

            details.CurrentDraggedItem = item;
            //copyProgress.Maximum = item.Count;

            IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null);

            dragPayload.SetData("DraggedData", item);
            dragPayload.SetData("DropDetails", details);

            e.Data = dragPayload;

            e.DragVisual = new DragVisual()
            {
                Content         = details,
                ContentTemplate = this.AssociatedObject.Resources["DraggedItemTemplate"] as DataTemplate
            };
            e.DragVisualOffset = e.RelativeStartPoint;
            e.AllowedEffects   = DragDropEffects.All;
        }
Esempio n. 4
0
        private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
            TreeListViewRow sourceRow = (e.OriginalSource as TreeListViewRow) ?? (e.OriginalSource as FrameworkElement).ParentOfType <TreeListViewRow>();

            if (sourceRow != null)
            {
                IDragPayload dataObject = DragDropPayloadManager.GeneratePayload(null);
                DragDropPayloadManager.SetData(dataObject, __dragSource, sourceRow.Item);
                e.Data = dataObject;
            }
        }
        private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
            // only on preview tab and edit mode drag and drop is allowed
            // for all items within the area and group in all Sales Estimating revisions
            // should be in one place while moving to avoid confusion
            if ((App.Current as App).SelectedTabIndexEstimateDetails == 3 &&
                ((App.Current as App).CurrentAction == "EDIT") &&
                (((App.Current as App).SelectedEstimateRevisionTypeID == 4) ||  // SE - Sales Estimating
                 ((App.Current as App).SelectedEstimateRevisionTypeID == 15) || // PVAR-SE
                 ((App.Current as App).SelectedEstimateRevisionTypeID == 19) || // BVAR-SE
                 ((App.Current as App).SelectedEstimateRevisionTypeID == 25)))  // PSTM-SE
            {
                DropIndicationDetails details = new DropIndicationDetails();
                var row = e.OriginalSource as GridViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType <GridViewRow>();

                var item = row != null ? row.Item : (sender as RadGridView).SelectedItem;
                details.CurrentDraggedItem = item;

                IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null);

                dragPayload.SetData("DraggedData", item);
                dragPayload.SetData("DropDetails", details);

                e.Data = dragPayload;

                e.DragVisual = new DragVisual()
                {
                    Content         = details,
                    ContentTemplate = this.AssociatedObject.Resources["DraggedItemTemplate"] as DataTemplate
                };
                e.DragVisualOffset = e.RelativeStartPoint;
                e.AllowedEffects   = DragDropEffects.All;
            }
            else
            {
                e.Cancel = true;
            }
        }
        private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
            DropIndicationDetails details = new DropIndicationDetails();
            var gridView = sender as RadGridView;

            details.DragSource = gridView.ItemsSource;

            var items = gridView.SelectedItems;

            details.CurrentDraggedItems = items;

            IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null);

            dragPayload.SetData("DraggedData", items);
            dragPayload.SetData("DropDetails", details);

            e.Data = dragPayload;

            e.DragVisual = new DragVisual {
                Content = details, ContentTemplate = AssociatedControl.Resources["DraggedItemTemplate"] as DataTemplate
            };
            e.DragVisualOffset = new Point(e.RelativeStartPoint.X + 10, e.RelativeStartPoint.Y);
            e.AllowedEffects   = DragDropEffects.All;
        }
        private void OnDragInitialize(object sender, DragInitializeEventArgs e)
        {
            DropIndicationDetails details = new DropIndicationDetails();
            var listBoxItem = e.OriginalSource as System.Windows.Controls.ListBoxItem ?? (e.OriginalSource as FrameworkElement).ParentOfType <System.Windows.Controls.ListBoxItem>();

            var item = listBoxItem != null ? listBoxItem.DataContext : (sender as System.Windows.Controls.ListBox).SelectedItem;

            details.CurrentDraggedItem = item;

            IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(null);

            dragPayload.SetData("DraggedData", item);
            dragPayload.SetData("DropDetails", details);

            e.Data = dragPayload;

            e.DragVisual = new DragVisual()
            {
                Content         = details,
                ContentTemplate = this.AssociatedObject.Resources["DraggedItemTemplate"] as DataTemplate
            };
            e.DragVisualOffset = e.RelativeStartPoint;
            e.AllowedEffects   = DragDropEffects.All;
        }