Polo,
In order to do this you will have to pass in a type that implements
ICustomTypeDescriptor. Once you have that, you will have to return the
properties with the appropriate attributes attached through the
GetProperties method. However, if you want to change the read-only status
while the property grid is attached to an object, you will probably have to
set the SelectedObject property again to rebind the property grid to the
type. The property grid probably assumes (reasonably) that you are not
going to change the type and therefore caches on the initial binding what is
read only and what is not.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Polo said:
Hi All,
I would like to apply dynamically the ReadOnlyAttribute(True - False) on a
class to lock or not the edition of instances of it in the property grid
An other solution is welcome.
Syncerely
Polo