DynamicObject databinding on DataGridView, System.Dynamic namespace
I have some collections of objects that inherits DynamicObject class, all works great with the BindingSource and BindingNavigator, but I don't have the dynamic properties displayed on the DatagridView.
The objects inherits DynamicObject and overrides the TrySetMember, TryGetMethod and GetDynamicMemberNames, I think that it is sufficient.
It also implements the INotifyPropertyChanged interface for the binding updates.
I'm forgetting something? or is it possible to do?
what I have now is:
protected BindingList<Users> _Users;
_Users = _Ctl.GetAll();
BndSrc.DataSource = _Users;
BndNav.BindingSource = BndSrc;
Grid.DataSource = 开发者_开发百科BndSrc;
Note: the _Ctl is a object that gives me all the users, the Users class inherits DynamicObject and have properties defined dynamically, like Username, Password and Name, it is all working well, but the datagrid don't display the dynamic properties.
Databinding to dynamic (DynamicObject) objects is broken and MS has resolved it as "Wont fix".
https://connect.microsoft.com/VisualStudio/feedback/details/522119/databinding-to-dynamic-objects-is-broken
精彩评论