implementing-wpf-dragdrop

Solid

Implements WPF drag and drop functionality using DragDrop.DoDragDrop, DataObject, and drag/drop events. Use when building file drop zones, list reordering, or inter-application data transfer.

AI & Automation 40 stars 6 forks Updated 6 days ago MIT

Install

View on GitHub

Quality Score: 78/100

Stars 20%
54
Recency 20%
100
Frontmatter 20%
40
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# WPF Drag and Drop Patterns Implementing drag and drop functionality for data transfer within and between applications. **Advanced Patterns:** See [ADVANCED.md](ADVANCED.md) for visual feedback, list reordering, and custom data formats. ## 1. Drag and Drop Overview ``` Drag Source Drop Target │ │ ├─ MouseDown │ ├─ MouseMove (drag threshold) │ ├─ DragDrop.DoDragDrop()───────────────┤ │ ├─ DragEnter │ ├─ DragOver │ ├─ DragLeave │ └─ Drop └─ GiveFeedback (cursor change) ``` --- ## 2. Basic Drag Source ### 2.1 Simple Text Drag ```csharp namespace MyApp.Views; using System.Windows; using System.Windows.Controls; using System.Windows.Input; public partial class DragSourceView : UserControl { private Point _startPoint; private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { _startPoint = e.GetPosition(null); } private void TextBlock_MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton != MouseButtonState.Pressed) return; var currentPoint = e.GetPosition(null); var diff = _startPoint - currentPoint; // Check if drag threshold is exceeded if (Math.Abs(diff.X) > SystemParamet...

Details

Author
christian289
Repository
christian289/dotnet-with-claudecode
Created
7 months ago
Last Updated
6 days ago
Language
C#
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category