Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# PropertyGrid - How to make array elements read only?

I have a PropertyGrid to which I add a array of bool-values. The array itself is marked as ReadOnly, which is recognized properly by the property grid.

BUT: If I expand the array in the Grid, all the items are editable by the user. Of course that's not what I want. If the array itself is marked a s ReadOnly all its elements shall be as well!

Is there any way to achieve this behavior in the PropertyGrid?

like image 676
Boris Avatar asked Oct 27 '25 09:10

Boris


1 Answers

You can define your own TypeConverter. Using a TypeConverter, you can control the properties that the PropertyGrid shows, and their behavior.

like image 188
GvS Avatar answered Oct 29 '25 00:10

GvS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!