Hiding Inherited Control's Properties

Is this possible

I'd like to inherit from a control so i can reuse some of it's base functionality, but override other parts.  I tried using Shadows and creating a property over one that already existed, but the WindowsForms designer cried about the property not being there, so is there an attribute or something I can add to just make it not visible or something or am I barking up the wrong tree


Answer this question

Hiding Inherited Control's Properties

  • Sithlrd

    Just a quick fix to my previous reply:

    Its actually the ControlDesigner class that has the properties/events hiding functions.

  • Jawad Ahmed

    originally, i wanted to inherit from the DataSet and put some stuff on top of it and hide some of the things that were already there, but I've changed my mind on this approach anyway, so actually I don't have an issue anymore...sorry for the weird question!
  • MMotor

    Your solution lies (partially) into UITypeEditor.

    A UITypeEditor will give you total control over the properties/events etc that the Control Properties Grid will display.

    Check all the UITypeEditor member functions.

    The reason i said partially is that these are only hidden from the Design Grid, but will not prevent you from using them in source code.

    I.E: I can hide the "MyControl.Enabled" property from the property grid, but its always possible to do : "MyControl.Enabled = false;" using code.

  • ppv

    yah, i know about that one, but I'm looking for a little more than that.
  • C#Mart

    Would you be able to just make a UserControl that has the control your inherited as a control that it contains with its dock property set to fill  That way you could expose only the properties you want.

    Paul Tyng

  • Puz

    Are you looking to hide these members at designtime or runtime   Why do you want to hide them   

    thanks
     - mike

  • BethR

    You can hide properties from the PropertyGrid with the Browsable(false) attribute.
  • Kaz33

    I'm afraid you won't find it. Removing members just isn't what inheritance is about.
  • Hiding Inherited Control's Properties