When I try to create a class in managed C++ that inherits from ObservableCollection I get the error:
error C2039: ‘ObservableCollection’ : is not a member of ‘System::Collections::ObjectModel’
Here’s my code:
using namespace System;
using namespace System::Collections;
using namespace System::Collections::Generic;
using namespace System::Collections::ObjectModel;
public ref class DataMatrix : public System::Collections::ObjectModel::ObservableCollection<array<Object^>^> {};
Why can’t I use this class from C++-CLI? I have no difficulty using it in C#.
Did you make sure to add a reference to WindowsBase.dll?
ObservableCollection<T>lives in this DLL and it is not included on the default references list for a C++ project.