i created wpf project it has a listbox item in D: Drive file when i select one or multiple file

public partial class MainWindow : Window
    {
        List<string> file = new List<string>();
        public MainWindow()
        {
            InitializeComponent();
            file.Add(@"D:\file1.txt");
            file.Add(@"D:\folder1");
            file.Add(@"D:\folder2");
            file.Add(@"D:\folder3");
            lstTest.DataContext = file;
        }


        private Point start;
        private void lstTest_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.start = e.GetPosition(null);
        }

        private void lstTest_MouseMove(object sender, MouseEventArgs e)
        {
            Point mpos = e.GetPosition(null);
            Vector diff = this.start - mpos;
            if (e.LeftButton == MouseButtonState.Pressed && Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance && Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)
            {
                if (this.lstTest.SelectedItems.Count == 0)
                {
                    return;
                }
                string[] Files = new string[file.Count] ;
                for (int i = 0; i < file.Count; i++)
                {
                    Files[i] = file[i];
                }
                string dataFormat = DataFormats.FileDrop;
                DataObject dataObject = new DataObject(dataFormat, (lstTest.SelectedItems.Cast<string>()).ToArray<string>());
                DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Copy);
            }
        }
    }

and i can drag and drop this file into my pc or desktop it work really good it stored file or folder in my physical file but,my boss says that server data or file are list in listview and download them and drag and drop to the pc pls if any idea or suggestion pls let me know!

Related posts

Recent Viewed