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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to set propertygrid readonly?

Thread ID:

Created:

Updated:

Platform:

Replies:

109835 Jul 6,2013 03:29 AM UTC Feb 26,2018 10:09 AM UTC WPF 9
loading
Tags: PropertyGrid
shenghao.wu
Asked On July 6, 2013 03:29 AM UTC

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 06:38 AM UTC

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 10:05 PM UTC

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 02:45 PM UTC

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 04:16 AM UTC

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 03:39 PM UTC

Hi,

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

Duane McKinney
Replied On December 23, 2016 07:26 PM UTC

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 27, 2016 04:53 AM UTC

  
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 05:54 PM UTC

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 10:09 AM UTC

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.

Warning Icon 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.Close Icon

;