I created a class that inherits from ObservableCollection<T> and wanted to use it instead of IList<T>. When I modified the generator to generate ObservableCollection<T> or MyCollectionClass<T>(inherits ObservableCollection<T>) it gives this error:

'MyCollectionClass' does not contain a definition for 'Customer' and no extension method 'Customer' accepting a first argument of type 'MyCollectionClass' could be found (are you missing a using directive or an assembly reference?)

Does anyone faced this problem before? Thanks for the help!

有帮助吗?

解决方案 3

I am answering to my own question: I created my own collection class and made it inherit from TrackedBindingList and implemented INotifyCollectionChanged. That took care of the issue.

其他提示

You can use TrackedBindingList, however when you do that you have to provide data type of the collection items.

companies.HasAssociation<Customer>(c => c.Customer)
    .WithOpposite(c => c.Company)
    .HasConstraint((c,​cc) => c.ID == cc.CustomerID);

You could troubleshoot the issue on your side using the information listed here and here.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top