Binding DynamicObject to a DataGrid with automatic column generation?

前端 未结 2 761
[愿得一人]
[愿得一人] 2020-12-03 06:03

I\'m still experimenting with DynamicObjects. Now I need some information: I\'m trying to bind an object inheriting from DynamicObject to a WPF DataGrid (not Silverlight). <

2条回答
  •  情深已故
    2020-12-03 06:35

    I think the DataGrid uses TypeDescriptor to get the object properties to create the columns. So you should be able to achieve this if your DynamicObject implements ICustomTypeDescriptor. Implement the GetProperties method so that it returns the dynamic properties of your object.

提交回复
热议问题