Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Both the datagrid headers are in the order as Filename, FileExtension and FilePath.
I have enabled multiple selection of rows in xaml by setting SelectionMode="Extended".

C# code

C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;


namespace FileListGrabber
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
            MyWindow_Loaded();
        }

        private void MyWindow_Loaded()
        {
            // Here I am fetching data from a CSV file
            var reader = new StreamReader(File.OpenRead(@"C:\BigB.csv"));

            // List to store data fetched from CSV file
            List<GetFile> Fetcher = new List<GetFile>();


            while (!reader.EndOfStream)
            {
                var line = reader.ReadLine();
                string[] values = line.Split(',');

                Fetcher.Add(new GetFile
                {
                    FileName = values[0],
                    FileExtension = values[1],
                    FilePath = values[2]
                }
                );
            }
            myGridView1.ItemsSource = Fetcher;
        }
        
        public class GetFile
        {
            public string FileName
            {
                get;
                set;
            }

            public string FileExtension
            {
                get;
                set;
            }

            public string FilePath
            {
                get;
                set;
            }
        }

        private void buttonRight_Click(object sender, RoutedEventArgs e)
        {
            // Code to move row in myGridView2
        }
        private void buttonLeft_Click(object sender, RoutedEventArgs e)
        {
            // Code to move row in myGridView1
        }
    }
}
Posted
Comments
Sinisa Hajnal 6-Nov-14 6:48am    
What have you tried? Where is the code that you wrote and doesn't work? This is not free code service. You have to put some effort into it.

1 solution

Think of it! It's quite simple. There are needed two lists (type of GetFile): 1. for source dgv and 2. for destination dgv.
Fetch data from first dgv into GetFile class, add to the second list and remove from first one.
Try!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900