I have a class that inherits ObservableCollection. Initially the collection is empty. When I bind it to the data grid and set the allow new to true. The add new row does not show up.
Here is some code:
this.xamDataGridTasks.DataSource=_contract.Tasks; this.xamDataGridTasks.FieldLayoutSettings.AllowAddNew = true; this.xamDataGridTasks.FieldLayoutSettings.AddNewRecordLocation = Infragistics.Windows.DataPresenter.AddNewRecordLocation.OnTop;
Hello,
One requirement for the AddNewRecord is that the underlying class has a parameterless constructor.
Does you class have one?
You can also use BindingList<T> instead of ObservableCollection.
Regards,
Alex.
Yes, ContractTask has a parameterless constructor
I will bring this matter up to the Technical Documentation Manager and will try to include this in the documentation.
That what it was. I have a recommendation. In your documentation you should spell that out.
Thanks for the quick help, much appreciation
I am sorry, I forgot to mention the more important requirement. The collection must implement IBindingList.
Some built-in collections that you can use are:
BindingList<T>, CollectionView, ListCollectionView, BindingListCollectionView.