I use PropertyGrid in the application that I am writing so that users can view and sometimes edit instances of my objects. Sometimes a user can open a file in read / write mode, where they can make changes to the file through the property grid. In other cases, they can open the file in read-only mode and should not make any changes to objects through PropetyGrid. My classes also have dynamic properties that are returned when implementing ICustomTypeDescriptor. That is why I really want to take advantage of the built-in flexibility of the PropertyGrid control.
There seems to be no easy way to set the property grid to read-only mode. If I turn off the PropertyGrid, this also prevents the user from scrolling through the list. Therefore, I think the best way to do this is to add ReadOnlyAttributes to the properties at runtime. Is there another way?
source share