Modifying property.cs properties during runtime

Dec 9, 2010 at 12:07 PM

Hi.

I would like to access and modify the IsReadOnly statement for the property but I can't find a way to retrieve it.

I tried to get them from propertyGrid.Properties but I only got the categories.

The problem i have is that I have a Datagrid that's bound to a list of a class. If you doubleclik a row then the proertyGrid opens and the instance is set to the specific class.
The user can change everything except the property "ObjectId" which is ReadOnly.
If the user instead  whant to add a new row to the datagrid, the propertygrid i set to a new class object with no values.
If i write:

[Category("Object")]
[
DisplayName("ObjectId"), ReadOnly(true)] 
public string ObjectId { get; set ; }

Then the ObjectId always is readonly.

So I changed the IsReadOnly in Property.cs to:

 public bool IsReadOnly { get; set;}

 But i don't know how to access it.

I hope this did'nt get to messy :-)

Please help me!