コード例 #1
0
ファイル: TableViewTest.cs プロジェクト: lishxi/_SharpMap
        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));
        }
コード例 #2
0
ファイル: TableViewTest.cs プロジェクト: lishxi/_SharpMap
        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));
        }
コード例 #3
0
ファイル: TableViewTest.cs プロジェクト: lishxi/_SharpMap
        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);
        }
コード例 #4
0
ファイル: TableViewTest.cs プロジェクト: lishxi/_SharpMap
        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);
        }
コード例 #5
0
ファイル: TableViewTest.cs プロジェクト: lishxi/_SharpMap
        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);
        }