Search code examples
c#propertygriduitypeeditor

PropertyGrid UITypeEditor Disable cell edit


I have a property grid and one of the properties uses a UITypeEditor to edit the value (on a form).

However the property is still editable, which I do not want. Is there a way to do this? I looked at this similar question Propertygrid UIEditor disabling value editing through Keyboard but it does not solve my problem as the solution is a simple dropdown list using TypeConverter.


Solution

  • For future use as these answer are not how it's done anymore. Set ReadOnly to true or default is false when not applied.

    [Browsable(true)]
    [ReadOnly(true)]
    [Description("Behind the scenes identifier for a record.")]
    [Category("Record Info")]
    [DisplayName("Identifier")]
    public string Identifier
    {
        get
        {
            return _identifier;
        }
        set
        {
            _identifier = value.Trim();
        }
    }