내 DataGrid의 셀을 떠날 때 BindingSource.AddingNew가 호출되지 않습니다.C# BindingSource.AddingNew가 호출되지 않습니다?
DataGrid에는 다시 "Customer"의 "List"가있는 BindingSource가 있습니다.
BindingSource는 새 Customer 개체를 만들고 기본 ICustomerList에 추가해야하는 대상은 무엇입니까?
인터페이스는 생성자가 없습니다 물론...
하지만 내 고객 객체는 기본 생성자가! 예외 한게
I 얻을 :
System.MissingMethodException: The constcructor for the type "SAT.EnCoDe.Administration.ICustomer" was not found.
BEI System.RuntimeType.CreateInstanceImpl (BindingFlags의 bindingAttr는 바인더 바인더 [] activationAttributes 개체 [] args를 CultureInfo를 배양 개체) BEI의 System.SecurityUtils.SecureCreateInstance을 (Type 형식, Object [] args) bei System.ComponentModel.BindingList 1.AddNewCore() bei System.ComponentModel.BindingList
1.System.ComponentModel.IBindingList.AddNew() bei System.Windows.Forms.BindingSource.AddNew() bei System.Windows.Forms.CurrencyManager .AddNew() bei DevExpress.Data.CurrencyDataController. OnCurrencyManagerAddNew() BEI DevExpress.Data.CurrencyDataController.AddNewRow() BEI DevExpress.XtraGrid.Views.Grid.GridView.OnActiveEditor_ValueModified (개체 보낸 사람, EventArgs입니다 전자) BEI DevExpress.XtraEditors.Repository.RepositoryItem.RaiseModified (EventArgs입니다 전자) BEI DevExpress.XtraEditors.BaseEdit.OnEditValueChanging (ChangingEventArgs E) BEI DevExpress.XtraEditors.TextEdit.OnMaskBox_ValueChanged (객체 송신자있는 EventArgs E) BEI DevExpress.XtraEditors.Mask.MaskBox.RaiseEditTextChanged() BEI System.Windows.Forms.TextBoxBase .WmReflectCommand (메시지 &m) bei DevExpress.XtraEditors.Mask.MaskBox.BaseWndProc (메시지 &m) bei DevExpress.XtraEditors.Ma sk.MaskBox.WndProc (메시지 & m) BEI DevExpress.XtraEditors.TextBoxMaskBox.WndProc (메시지 & MSG) BEI System.Windows.Forms.Control.ControlNativeWindow.WndProc (메시지 & m) BEI System.Windows.Forms. NativeWindow.Callback (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
wpf ... 좋은 200000 LOC 응용 프로그램은 아름다운 wpf의 빛을 결코 보지 못할 것입니다 ... http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource. allownew.aspx 그 링크에서 AllowNew가 false로 설정된 이유 3 가지를 보았습니다. 내 BindingSource 속성 AllowNew. 나는 그 이유 3 그래서 나는 그것이하여 매개 변수가의 ctor 추가 고정 생각하지만, 또 다른 ctor에이 고객 개체에 대한) 새 GUID (하나 개 매개 변수가 있기 때문에 아직도 내가 어쩌면 을 같은 오류가? – msfanboy
매개 변수가있는 두 번째 Ctor를 제거했습니다./ – msfanboy
ok 여기까지 이동 : 기본 Ctor가있는 경우에도 BindingSource의 속성 창에서 DataSource 유형을 할당 할 때 AddNew 속성을 FALSE로 설정합니다. ICustomerList. IBindingList를 구현하는 BindingList 또는도 있습니다. 모든 요구 사항에도 불구하고 완벽하게 작동하지 않습니다. 그래서 BindingSource_AddNew 이벤트를 catch하고 을 통해 새 고객을 추가하십시오. e.NewObject = new Customer (Guid.NewGuid()); 지금까지 작동 ... –
msfanboy