hanseh

HI... I am trying to disable a certain property in my property grid when a certain property is change. For example, I have a TextVisible which is a boolean property and I also have a text color and font property. If I set text visble to false, I want the color and font property to be disabled. This is at the design view part. Is there a disable property the characteristic of a disabled property is like a property without the "set" in its property class. Thank you.... Hope someone could help.



Re: Windows Forms General How to disable a property in the property grid?

Gavin Jin - MSFT

Hi, first I will check my understanding with you, if there is any misunderstanding with you, feel free to let me know.

You want to change the ReadOnly attribute of the item in a PropertyGrid at runtime, don't you

The PropertyGrid in its current state does not support this. The only way is to create a custom PropertyGrid. When the property value changes, you change the descriptor for your type to indicate that the property is read-only.
There are many relate articles about it, for more information, check following links

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=328945&SiteID=1

http://www.thescripts.com/forum/thread268342.html

http://www.thescripts.com/forum/thread379425.html

Best Regards

Gavin






Re: Windows Forms General How to disable a property in the property grid?

VisualHint

Hi,

Gavin gave you the right explanations concerning the Microsoft PropertyGrid. You will also find a lot of resources about Property and Type Descriptors on the Microsoft PropertyGrid Resource List.

However, if you are fed up with this complexity and if a commercial solution is an option for you, have a look at Smart PropertyGrid.Net. Each row in the grid has a Readonly property that you can modify at runtime.

Best regards,

Nicolas Cadilhac @ VisualHint
Smart PropertyGrid.Net
Microsoft PropertyGrid Resource List
Free PropertyGrid for MFC
Smart FieldPackEditor.Net / DateTimePicker





Re: Windows Forms General How to disable a property in the property grid?

hanseh

Thanks guys... my application is now working properly .thanks and more power