void newt_Drop(object sender, DragEventArgs e) {
e.Handled = true;
var tabItemTarget = e.Source as Wpf.Controls.TabItem;
var tabItemSource = e.Data.GetData(typeof(Wpf.Controls.TabItem)) as Wpf.Controls.TabItem;
if (tabItemSource == null) {
if ((sender as Wpf.Controls.TabItem).ShellObject.IsFileSystem) {
e.Effects = (e.KeyStates & DragDropKeyStates.ControlKey) == DragDropKeyStates.ControlKey ? DragDropEffects.Copy : DragDropEffects.Move;
switch (e.Effects) {
case DragDropEffects.All:
break;
case DragDropEffects.Copy:
this._ShellListView.DoCopy(e.Data, (sender as Wpf.Controls.TabItem).ShellObject);
break;
case DragDropEffects.Link:
break;
case DragDropEffects.Move:
this._ShellListView.DoMove(e.Data, (sender as Wpf.Controls.TabItem).ShellObject);
break;
case DragDropEffects.None:
break;
case DragDropEffects.Scroll:
break;
default:
break;
}
} else {
e.Effects = DragDropEffects.None;
}
WIN.Point pt = e.GetPosition(sender as IInputElement);
var wpt = new BExplorer.Shell.DataObject.Win32Point() { X = (int)pt.X, Y = (int)pt.Y };
DropTarget.Create.Drop((System.Runtime.InteropServices.ComTypes.IDataObject)e.Data, ref wpt, (int)e.Effects);
this._TabDropData = null;
} else if (!tabItemTarget.Equals(tabItemSource)) {
var tabControl = tabItemTarget.Parent as TabControl;
int targetIndex = tabControl.Items.IndexOf(tabItemTarget);
int tabState = tabItemSource == this._CurrentlySelectedItem ? 0 : 1;
tabControl.Items.Remove(tabItemSource);
tabControl.Items.Insert(targetIndex, tabItemSource);
tcMain.IsInTabDragDrop = false;
if (tabState == 1)
tabControl.SelectedItem = this._CurrentlySelectedItem;
else if (tabState == 0)
tabControl.SelectedIndex = targetIndex;
tcMain.IsInTabDragDrop = true;
}
//tcMain.IsSelectionHandled = false;
}