I have a container control with some private child control. How to hide the property browser from showing the control at design time. also it shows a lock and a square icon on each of the control at design time.
I tried to set for the control
<Browsable(False), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Bindable(False)>
<EditorBrowsable(EditorBrowsableState.Never)>
also tried to set <DesignTimeVisible(False), ToolboxItem(False)>
for the child control. but still shows up in the designer even though it is not editable.
Currently I am painting the control at design time and on runtime loading the real control. is there a simpler way to do this?
Option 1 - Set GenerateMember = false
In the design mode of the base control, set GenerateMember
property of the child control to false
. This way the derived control wont allow selection of the button.
Option 2 - Using TypeDescriptor set a new non-working designer for the child control
Another trick is setting a new non-working designer for child control using typeDescriptor.AddAttributes
, in the constructor of the base control, after initialize components:
TypeDescriptor.AddAttributes(this.button1, new DesignerAttribute(typeof(object)));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With