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.
Unfortunately, activation email could not send to your email. Please try again.

how to set propertygrid readonly?

Thread ID:

Created:

Updated:

Platform:

Replies:

109835 Jul 5,2013 11:29 PM Feb 26,2018 05:09 AM WPF 9
loading
Tags: PropertyGrid
shenghao.wu
Asked On July 5, 2013 11:29 PM

Hi, I want to set my propertygrid control readonly or editable depending on some condition.
for example, in this page, the same propertygrid will be readonly, in another page, the same propertygrid will be editable, is that possible?

Karuppasamy P [Syncfusion]
Replied On July 10, 2013 02:38 AM

Hi Shenghao,

Sorry for the delay caused.

Kindly find the sample below.

In the sample, we are getting the property using VisualUtils in the ButtonClick event. Hence by Enabling/Disabling the property, you can set the 'readonly' accesses.

Please let us know if you have any other queries.

Regards,
Karuppasamy P


PropertyGridControlSample_a248cefb.zip

Michelle Fowler
Replied On October 10, 2013 06:05 PM

When I set PropertyGrid.IsEnabled = False, the scroll bar and expanders no longer work. I want it to be displayed in a true read-only mode, where it is completely interactive, but none of the editors allow changing of values. How can I do that?

Michelle Fowler
Replied On October 11, 2013 10:45 AM

I added the attribute ReadOnly(true) to those properties that have a non-private setter but should not be changed by the user.

Example:

        [ReadOnly(true)]
        public double Multiplier { get; set; }


Jegan Raj M [Syncfusion]
Replied On October 21, 2013 12:16 AM

Hi Michelle,

Thanks for your interest in Syncfusion products.

We have created sample based on your request in which the property 'Multiplier' is set as ready only property. By clicking the Button all the properties are set to 'IsEnabled=False" and the scroll viewer will work.

Please let us know if you need further assistance.

Regards,
Jegan Raj M


PropertyGridSample_e0d389f3.zip

Krzysztof Nowacki
Replied On December 18, 2014 10:39 AM

Hi,

When I'm trying to download the second sample, I get access denied error.

Duane McKinney
Replied On December 23, 2016 02:26 PM

I know this is old, but it was the first search result.  

This is a very simple solution that worked for me.  By setting the setter to internal access, it doesn't allow the PropertyGrid control to modify it.  In a more complex project you'll have to go with a more complex solution.
public MyProperty State { getinternal set; }

Keerthana Jegannathan [Syncfusion]
Replied On December 26, 2016 11:53 PM

  
Hi Duane, 
Thank you for your suggestion. 

As you have mentioned, this will work for simple solution and you can use the same as you suggested.

Regards,
 
Keerthana J 


Fernando Salvador
Replied On February 25, 2018 12:54 PM

Hi, I want to set my propertygrid control readonly or editable depending on some condition.
for example, in this page, the same propertygrid will be readonly, in another page, the same propertygrid will be editable, is that possible?

.

Keerthana Jegannathan [Syncfusion]
Replied On February 26, 2018 05:09 AM

Hi Fernando, 
 
Thanks for your update. 
 
Have you tried the setting of property setter as internal one which makes the properties in the PropertyGrid as ReadOnly? Or else, can you share some additional information about your requirement? That helps us to provide and analyze solution at earliest. 
 
Regards, 
 
Keerthana J 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;