Sadegh
Sadegh

Reputation: 4341

how to remove unnecessary properties from user control?

i want to remove unnecessary properties from user control. But I do not know what way?

Upvotes: 3

Views: 3395

Answers (2)

Hans Passant
Hans Passant

Reputation: 941545

You can remove inherited properties from the Properties window with the [Browsable] attribute:

[Browsable(false)]
public override bool AutoScroll {
  get { return base.AutoScroll; }
  set { base.AutoScroll = value; }
}
[Browsable(false)]
public new Size AutoScrollMargin {
  get { return base.AutoScrollMargin; }
  set { base.AutoScrollMargin = value; }
}

Note the difference between the two, you have to use the "new" keyword if the property isn't virtual. You can use the [EditorBrowsable(false)] attribute to also hide the property from IntelliSense.

Upvotes: 10

dtb
dtb

Reputation: 217313

You can't remove the properties your control inherits from UserControl.

You can, of course, remove properties you've created yourself. Just delete them from your source file.

Upvotes: 1

Related Questions