I’ve got a small app which will allow the user to select a number of files and then perform some processing. I was thinking I’d collect the files in an ObservableCollection of String^ (and probably expand this to a full class at a later date).
The problem is I can’t work out how to bind the ListView to the ObservableCollection. I’ve added a property to the main form:
protected:
ObservableCollection<String^>^ m_sourceFiles;
public:
property ObservableCollection<String^>^ SourceFileList
{
ObservableCollection<String^>^ get() {return m_sourceFiles;}
}
All the examples I’ve seen for C# / VB implementations switch to using XAML at this point, but I can’t see how to do that in C++? Where do I go from here?
There’s a
DataSourceproperty onDataGridView,ListBox, andComboBox. Can you use one of those?System.Windows.Forms.ListViewdoesn’t have support for data-binding. However, you can use virtual mode and handle the RetrieveVirtualItem event.