Exemple #1
0
        public void SetRowCellValueDoesNotWorkOnReadOnlyCell()
        {
            var table = new DataTable();
            table.Columns.Add("readonlycolumn", typeof(string));

            table.Rows.Add(new object[] { "1" });

            var tableView = new TableView { Data = table };

            //read only cell
            tableView.ReadOnlyCellFilter += delegate { return true; };
            

            tableView.SetRowCellValue(0, 0, "2");

            Assert.AreEqual("1", tableView.GetRowCellValue(0, 0));
        }
Exemple #2
0
        public void SetRowCellValueDoesNotWorkOnReadOnlyColumns()
        {
            var table = new DataTable();
            table.Columns.Add("readonlycolumn", typeof(string));
            
            table.Rows.Add(new object[] { "1" });
            
            var tableView = new TableView { Data = table};

            //read only first column
            tableView.Columns[0].ReadOnly = true;
            
            tableView.SetRowCellValue(0,0,"2");

            Assert.AreEqual("1",tableView.GetRowCellValue(0,0));
        }
Exemple #3
0
        public void SetRowCellValue()
        {
            var persons = new BindingList<Person> { new Person { Age = 22, Name = "Jan" } };
            var tableView = new TableView { Data = persons };

            //action! change the top left cell
            tableView.SetRowCellValue(0, 0, "Kees");

            Assert.AreEqual("Kees", persons[0].Name);
        }
Exemple #4
0
        public void SetRowCellValueIsBasedOnVisibleIndexes()
        {
            var persons = new BindingList<Person> { new Person { Age = 22, Name = "Jan" } };
            var tableView = new TableView { Data = persons };

            //hide the first column
            tableView.Columns[0].Visible = false;
            
            //action! change the top left cell
            tableView.SetRowCellValue(0, 0, "23");

            Assert.AreEqual(23, persons[0].Age);
        }
Exemple #5
0
        public void SetRowCellValueGeneratesCellChangedEvent()
        {
            var table = new DataTable();

            table.Columns.Add("column", typeof (string));
            table.Rows.Add(new object[] {"1"});

            var tableView = new TableView {Data = table};

            int callCount = 0;
            tableView.CellChanged += (s, e) =>
                                         {
                                             callCount++;
                                             Assert.AreEqual(0, e.Value.ColumnIndex);
                                             Assert.AreEqual(0, e.Value.RowIndex);
                                         };
            tableView.SetRowCellValue(0, 0, "2");
            Assert.AreEqual(1, callCount);
        }