//Unselect items public void LvMouseDown(TsView view, Point e) { HitTestResult r = VisualTreeHelper.HitTest(view, e); if (r.VisualHit.GetType() != typeof(ListViewItem)) { foreach (var item in TsItems) { item.IsSelected = false; } } }
//DragDrop public void LvMouseMoveDragDrop(TsView view) { if (Mouse.LeftButton != MouseButtonState.Pressed) { return; } if (SelectedItem == null) { return; } if (Mouse.DirectlyOver.GetType() == typeof(TextBox)) { return; } DragDrop.DoDragDrop(view, new DataObject(SelectedItem), DragDropEffects.Copy); }