Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1355
Renaming caption/Name of Dynamically added colum thru property descriptor
posted

Hi,

    I have a Class A which implements bindinglist<B>  and ITypedList ( returns propertydescriptorcollection) and am using it as a datasource for grid. Internally i use propertydescriptors  which allows user's to add new columns dynamically to the grid.If user'  decides to rename the newly added customproperty, how can i do that? and what is the ideal way of doing that?

I am trying to implement by renaming the property in my underlying object which in turn shoud reflect in the grid when it queries property descriptor collection. It partly works when there is no data for that column and i can rename as many times i want. But when i type some value on the column and then i try to rename the property, It throws me a runtime exception ( index out of range in cell collection) where grid can't load .So i am guessing am not follwing the right approach.

I really appreciate ur suggestions.

Thanks,

Valliappan

Parents
  • 469350
    Offline posted

    If you change the name of on of your properties, I don't think the IBindingList implementation has any way of knowing that this occurred and therefore it cannot notify the grid that this happened.

    You probably have to fire off a ListChanged notification on your BindingList for PropertyDescriptiorChanged. You will also need to do this for PropertyDescriptorAdded and PropertyDescriptorRemove when you add or remove properties.

Reply Children