How punker76/gong-wpf-dragdrop works
Project type and purpose
• This is an open-source .NET library (GongSolutions.WPF.DragDrop) providing drag-and-drop functionality for WPF items controls (ListBox, TreeView, DataGrid, etc.) with MVVM support.
• It also includes a “Showcase” WPF application demonstrating usage of the library.
File structure
• Top-level: build scripts (Cake, PowerShell), CI configs (.github/workflows, AppVeyor), solution files, README, LICENSE.
• src/GongSolutions.WPF.DragDrop: the class library containing
• Interfaces (IDragInfo, IDropInfo, IDragSource, IDropTarget, etc.)
• Core engine (DragDrop.cs, handlers, builders)
• Adorners & preview classes (DropTargetAdorner, DragDropEffectPreview, etc.)
• Utilities for hit testing, visual tree traversal, DPI.
• src/Showcase: WPF demo app with MVVM structure (Views, ViewModels, Models), showing sample controls wired to the library.
README
• Emphasizes MVVM integration via attached properties.
• Lists supported controls and features (multiple selection, insertion/move/copy, adorners, previews).
• Points to build instructions and usage wiki.
Main components & interactions
a. WPF Host & ItemsControls
• Represents the WPF runtime and controls (ListBox, TreeView, DataGrid).
b. GongSolutions.WPF.DragDrop Library
• Attached-Properties Layer: DragDrop.IsDragSource, .IsDropTarget
• Core Engine:
• DragInfoBuilder / DropInfoBuilder
• DefaultDragHandler / DefaultDropHandler
• Interfaces (IDragInfo, IDropInfo, …)
• Visual Feedback: Adorners, Preview renderers, IconFactory
• Utilities: HitTestUtilities, VisualTreeExtensions, DPI helpers
c. MVVM Application (Showcase)
• ViewModels implement ICommand or handler interfaces (IDragSource, IDropTarget)
• Models (ItemModel, TreeNode, etc.)
• Views wired via attached properties to ViewModel handlers
d. Build & Distribution
• Cake build script → NuGet package
• CI (GitHub Actions, AppVeyor)
• Versioning (GitVersion, GitReleaseManager)
Relationships & data flow
• Flow into Core Engine → builds DragInfo → invokes DragHandler → optionally shows Preview.
• On drop: Input flows into DropInfoBuilder → DefaultDropHandler or custom handler in ViewModel.
• Adorners rendered on VisualLayer to give feedback.
• App uses library’s attached properties to bind its ViewModels to controls.
Architectural patterns & design principles
• MVVM: Separation of View (XAML) and logic (ViewModels implementing drag/drop interfaces).
• Attached-Property pattern: exposes drag/drop behavior without code-behind.
• Strategy/Handler pattern: pluggable drag and drop handlers via interfaces.
• Layered design: UI → Attached Properties → Core Engine → Utilities.
[ ] All major library modules shown: Attached-Properties, Core, Adorners, Utilities
[ ] Controls & WPF host clearly separated from library
[ ] Showcase app layers (Views, ViewModels, Models) connected to library API
[ ] External dependencies (NET Framework/NET 6) noted