コード例 #1
0
 private BudgetEditorDragDropHandler(BudgetEditor budgetEditor, BudgetEditorCategoryRow categoryRow, Point dragStartPosition)
 {
     this.BudgetEditor      = budgetEditor;
     this.DragType          = BudgetEditorDragTypes.Category;
     this.CategoryRow       = categoryRow;
     this.DragStartPosition = dragStartPosition;
 }
コード例 #2
0
        internal void OnDrop(DragEventArgs e)
        {
            UpdateDrag(e);

            if (DragType == BudgetEditorDragTypes.Category)
            {
                TargetMasterCategory.HandleDrop(this);
            }
            else if (DragType == BudgetEditorDragTypes.MasterCategory)
            {
                BudgetEditor.HandleDrop(this);
            }
        }
コード例 #3
0
        public static BudgetEditorDragDropHandler CreateFromEvent(BudgetEditor budgetEditor, MouseButtonEventArgs e)
        {
            var point   = e.GetPosition(budgetEditor);
            var hitTest = VisualTreeHelper.HitTest(budgetEditor, point);

            var categoryRow = hitTest?.VisualHit.FindParent <BudgetEditorCategoryRow>();

            if (categoryRow != null)
            {
                return(new BudgetEditorDragDropHandler(budgetEditor, categoryRow, point));
            }

            var masterCategoryRow = hitTest?.VisualHit.FindParent <BudgetEditorMasterCategoryRow>();

            if (masterCategoryRow != null)
            {
                return(new BudgetEditorDragDropHandler(budgetEditor, masterCategoryRow, point));
            }

            return(null);
        }
コード例 #4
0
        private DragAdorner CreateDragAdorner()
        {
            DragVisual = CreateDragVisual();

            var rootElement = Window.GetWindow(DraggingUIElement).Content as UIElement;
            //var rootElement = DraggingUIElement.FindParent<ScrollViewer>();
            DragAdorner adorner = new DragAdorner(rootElement, DragVisual, new Point(-4, -4));

            adorner.MaxAdornerPosX = BudgetEditor.CategoryItemsScrollViewer?.ActualWidth + BudgetEditor.TranslatePoint(new Point(), rootElement).X;
            return(adorner);
        }