Pregunta

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!

¿Fue útil?

Solución 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.

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top