Maybe it should be useful to have distinctive read-only columns as an optional OLV behaviour. That's because users have no other indication whether tabular data is editable or not. In my experience, not only read-only columns text color should be grayed out (i.e. color=Gray), but also column background should be grayed-out a bit as well (i.e. color=WhiteSmoke).
Few tips if this suggestion ever gets implemented:
Read-only column "behaviour" may be explicit or implicit:
Public ReadOnly Property Name() As String
is read only, but
Public Property Name() As String
is not.
Implicit read-only behaviour may be grabbed from ReadOnlyAttribute:
// Gets the attributes for the property.
AttributeCollection attributes =
TypeDescriptor.GetProperties(this)["MyProperty"].Attributes;
// Checks to see whether the value of the ReadOnlyAttribute is Yes.
if(attributes[typeof(ReadOnlyAttribute)].Equals(ReadOnlyAttribute.Yes)) {
// Insert code here.
}
// This is another way to see whether the property is read-only.
ReadOnlyAttribute myAttribute =
(ReadOnlyAttribute)attributes[typeof(ReadOnlyAttribute)];
if(myAttribute.IsReadOnly) {
// Insert code here.
}
You can do this simply with existing functionality: