private BudgetEditorDragDropHandler(BudgetEditor budgetEditor, BudgetEditorCategoryRow categoryRow, Point dragStartPosition)
 {
     this.BudgetEditor      = budgetEditor;
     this.DragType          = BudgetEditorDragTypes.Category;
     this.CategoryRow       = categoryRow;
     this.DragStartPosition = dragStartPosition;
 }
        internal void OnDrop(DragEventArgs e)
        {
            UpdateDrag(e);

            if (DragType == BudgetEditorDragTypes.Category)
            {
                TargetMasterCategory.HandleDrop(this);
            }
            else if (DragType == BudgetEditorDragTypes.MasterCategory)
            {
                BudgetEditor.HandleDrop(this);
            }
        }
        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);
        }
        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);
        }