The way to do this would be to not have it be an actual property on the class but to have it be a pseudo property which is provided by a designer for the class. Something like this:
public class MyButtonDesigner : ControlDesigner { protected override void PreFilterProperties(System.Collections.IDictionary properties) { base.PreFilterProperties(properties); properties[_CustomPropertyDescriptor.Name] = _CustomPropertyDescriptor; } private bool _CustomProperty=false; [DesignOnly(true)] [DefaultValue(false)] public bool CustomProperty { get { return _CustomProperty; } set { _CustomProperty = value; } } private static PropertyDescriptor _CustomPropertyDescriptor = TypeDescriptor.CreateProperty(typeof(MyButtonDesigner), "CustomProperty", typeof(bool)); } [Designer(typeof(MyButtonDesigner))] public class MyButton : Button { }
|