We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Hiding properties of the SelectedObject in the PropertyGrid

Hi,
I have a class that is assigned as the SelectedObject of the PropertyGrid control. Is there a way to hide some of my class' properties from being displayed in the PropertyGrid? There are some values I supply by default and I do not want users to be able to change them.

Thanks in advance.
Alessandro

3 Replies

VR Venkateshwaran Ramdoss Syncfusion Team November 23, 2015 09:37 AM UTC

Hi Alessandro,

Thank you for contacting Syncfusion Support.

Query#1:" Is there a way to hide some of my class' properties from being displayed in the PropertyGrid?"

Yes, In our PropertyGrid the particular property can be hide by using "HidePropertiesCollection". Please refer the below KB to hide the property in PropertyGrid.

Link: https://www.syncfusion.com/kb/3859/how-to-hide-a-particular-type-property-in-the-propertygrid

Query#2:"Given value by default do not want users to be able to change them?"

We can avoid editing the property value by using "ReadOnly" attribute. We have created a sample with "ReadOnly" attribute. In tihs sample we have hide the property "Name" and we have used ReadOnly property for "Area" and "Mobile".

Please download the sample from below.

Sample:PropertyGridSample

Please let us know if you need further assistance.

Regards,
Venkateshwaran V.R.


AD Alessandro Del Sole November 23, 2015 05:18 PM UTC

Thank you so much, this really helped.

Alessandro


VR Venkateshwaran Ramdoss Syncfusion Team November 24, 2015 05:04 AM UTC

Hi Alessandro,

We are glad that your issue has been resolved.
Please let us know if you need any other assistance.

Regards,
Venkateshwaran V.R.

Loader.
Up arrow icon