Steven Moore

Steven Moore

  • NA
  • 8
  • 2.3k

How Do You Hide a Standard Property at Design Time?

Mar 11 2014 5:23 AM

I'm experienced in using and have decided to teach myself C#.
I'm getting some of the basics but I've come across something that has stumped me.

How do you hide a property in the property window and intellisense at design time?

I've come across a few sites that have suggested different methods but none seem to work correctly.

The property that I'm trying to hide in this instance is the BorderStyle property of a UserControl.

I have tried adding a BorderStyle property that is Private and it still shows, but sets the BorderStyle to none.
private new BorderStyle BorderStyle { get; set; }

I have tried setting this property so that it isn't browsable, but it still shows and sets the BorderStyle to none again.
private new BorderStyle BorderStyle { get; set; }

I've even tried to set it as EditorBrowsable(EditorBrowsableState.Never) but I get the same results.
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
private new BorderStyle BorderStyle { get; set; }

I want it to be as though the BorderStyle property doesn't exist but the control needs to keep it's border.

Any help would be much appreciated!