Exemplo n.º 1
0
        public void CopySelectionIntoClipBoard()
        {
            var table = new DataTable();
            table.Columns.Add("column1", typeof(string));
            table.Columns.Add("column2", typeof(string));
            table.Rows.Add(new object[] { "1", "2" });
            table.Rows.Add(new object[] { "3", "4" });

            var tableView = new TableView { Data = table };

            //select two rows
            tableView.SelectCells(0, 0, 1, 1);

            //action! copy selection to clipboard
            //tableView.CopySelection
            tableView.CopySelectionToClipboard();

            Assert.AreEqual("1\t2\r\n3\t4\r\n", Clipboard.GetText());
        }