https://bugzilla.novell.com/show_bug.cgi?id=664837
https://bugzilla.novell.com/show_bug.cgi?id=664837#c0 Summary: Binding to a list of objects that implement IEditableObject doesn't work correctly Classification: Mono Product: Mono: Class Libraries Version: 2.6.x Platform: x86 OS/Version: Windows 7 Status: NEW Severity: Normal Priority: P5 - None Component: Windows.Forms AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1036 Safari/532.5 Binding to a list of objects that implement IEditableObject doesn't work correctly. Edited values are not written back to the data source. Reproducible: Always Steps to Reproduce: [Test] public void Test_BindingToIEditableObject() { BindingList<TestEditableObject> list = new BindingList<TestEditableObject>(); list.AddNew(); TextBox textBox = new TextBox(); textBox.DataBindings().Add("Text", list, "List.IntProperty"); Form.Controls.Add(textBox); Form.Show(); Application.DoEvents(); var detail = list[0].List.AddNew(); detail.IntProperty = 5; AssertEquals("5", textBox.Text, "TextBox bound correctly"); } Form form; Form Form { get { return form ?? (form = new Form()); } } class TestEditableObject : IEditableObject { BindingList<TestRelatedEditableObject> list; public BindingList<TestRelatedEditableObject> List { get { return list ?? (list = new BindingList<TestRelatedEditableObject>()); } } void IEditableObject.BeginEdit() { } void IEditableObject.CancelEdit() { } void IEditableObject.EndEdit() { } } class TestDataSourceWithRelatedObjects { public event EventHandler ObjPropertyChanged; TestDataSource objProperty; public TestDataSource ObjProperty { get { return objProperty; } set { objProperty = value; if (ObjPropertyChanged != null) { ObjPropertyChanged(this, EventArgs.Empty); } } } public BindingList<TestDataSource> List { get; set; } } class TestRelatedEditableObject : IEditableObject, INotifyPropertyChanged { public event EventHandler IntPropertyChanged; int intProperty; public int IntProperty { get { return intProperty; } set { intProperty = value; if (IntPropertyChanged != null) { IntPropertyChanged(this, EventArgs.Empty); } if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("IntProperty")); } } } public event PropertyChangedEventHandler PropertyChanged; void IEditableObject.BeginEdit() { } void IEditableObject.CancelEdit() { } void IEditableObject.EndEdit() { } } class TestDataSource { public event EventHandler IntPropertyChanged; public const int IntPropertyDefaultValue = 5; int intProperty = IntPropertyDefaultValue; public int IntProperty { get { return intProperty; } set { intProperty = value; if (IntPropertyChanged != null) { IntPropertyChanged(this, EventArgs.Empty); } } } } Actual Results: Unit test fails Expected Results: Unit test should pass, as it does on ms.net. To fix, remove CurrencyManager.editing field.. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
