private void OnPreviewDrop(object sender, DragEventArgs e)
        {
            if (!AllowDrop)
            {
                return;
            }
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                var itemsToAdd = (string[])e.Data.GetData(DataFormats.FileDrop);
                e.Effects = DefaultDropEffect;

                var data = new FilesDroppedEventArgs(FilesDroppedCommandParameter, itemsToAdd);
                if (FilesDroppedCommand != null && FilesDroppedCommand.CanExecute(data))
                {
                    FilesDroppedCommand.Execute(data);
                }
            }
            else if (e.Data.GetDataPresent(DataFormats.Text))
            {
                var itemsToAdd = e.Data.GetData(DataFormats.Text).ToString()
                                 .Split(new[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
                e.Effects = DefaultDropEffect;

                var data = new FilesDroppedEventArgs(FilesDroppedCommandParameter, itemsToAdd);
                if (FilesDroppedCommand != null && FilesDroppedCommand.CanExecute(data))
                {
                    FilesDroppedCommand.Execute(data);
                }
            }
            else
            {
                e.Effects = DragDropEffects.None;
            }
            DetachDragAdorner();
            e.Handled = true;
        }
        private void OnPreviewDrop(object sender, DragEventArgs e)
        {
            if (!AllowDrop) return;
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                var itemsToAdd = (string[])e.Data.GetData(DataFormats.FileDrop);
                e.Effects = DefaultDropEffect;

                var data = new FilesDroppedEventArgs(FilesDroppedCommandParameter, itemsToAdd);
                if (FilesDroppedCommand != null && FilesDroppedCommand.CanExecute(data))
                {
                    FilesDroppedCommand.Execute(data);
                }
            }
            else if (e.Data.GetDataPresent(DataFormats.Text))
            {
                var itemsToAdd = e.Data.GetData(DataFormats.Text).ToString()
                                    .Split(new[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
                e.Effects = DefaultDropEffect;

                var data = new FilesDroppedEventArgs(FilesDroppedCommandParameter, itemsToAdd);
                if (FilesDroppedCommand != null && FilesDroppedCommand.CanExecute(data))
                {
                    FilesDroppedCommand.Execute(data);
                }
            }
            else
            {
                e.Effects = DragDropEffects.None;
            }
            DetachDragAdorner();
            e.Handled = true;
        }