I am using a WPF ListView where SelectionMode is Extended (you can select multiple items only by pressing ctrl). I need to implement D&D between two ListViews. To execute the drag event, I used the DragItem event in WinForms, but such an event is not provided in wpf. I decided to use ListViewItem PreviewMouseDownClick
private void ListViewItemMouseDownClick(object sender, MouseButtonEventArgs e) { if (!this.AllowDragDrop) { return; } DragDrop.DoDragDrop( ListViewItemsCollection, this.SelectedItems, DragDropEffects.Copy | DragDropEffects.Move); }
Unfortunately, this solution has an error: one element works (without pressing Ctrl). However, I need to double-click to select an item while ctrl is pressed to select multiple items. There is no difference when using ListView PreviewMouseDown or ListViewItem PreviewMouseDown. Any ideas how to solve the problem?
user2160375
source share