In a test project, I was able to auto-generate the columns of DataGrid WPF in the following scenario, where the data is stored in a dictionary, and the binding is done through PropertyDescriptors:
public class People:List<Person>{ ... } public class Person:Dictionary<string,string>,INotifyPropertyChanged,ICustomTypeDescriptor { }
The problem I am facing in my real life project is I am using MVVM, so it is a PeopleViewModel that inherits ViewModelBase and therefore cannot inherit List <Person>. I tried to implement an IList <Person> instead with an internal <Person> list and explicitly setting the DataContext to an IList <Person> link, but that didn't work.
I saw a similar publication on WinGridView forms binding here , so I wonder if the same logic is applied in WPF, and first of all, which exactly causes the implementation of ICustomTypeDescriptor when inheriting List <T> which is missing when you just implement IList <T> instead .
c # wpf
Grokodile
source share