Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Inheriting a class and using property grid

Inheriting a class and using property grid

Scheduled Pinned Locked Moved C#
cssquestion
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kselman
    wrote on last edited by
    #1

    I have a class inheriting another class. Im using the property grid to let the user modify data in that second class. the base class has an enum I dont want displayed in the property grid. Ive used attributes to hide and document items int the base class. what can be done to hide things when viewing the property grid from the inherited class?

    L 1 Reply Last reply
    0
    • K kselman

      I have a class inheriting another class. Im using the property grid to let the user modify data in that second class. the base class has an enum I dont want displayed in the property grid. Ive used attributes to hide and document items int the base class. what can be done to hide things when viewing the property grid from the inherited class?

      L Offline
      L Offline
      LongRange Shooter
      wrote on last edited by
      #2

      I'm not sure if you poorly wrote your question for brevity or if you have problems using English. But I will try to answer your question as I understand it. I suggest you try to be as verbose in your future questions as possible. An object, whether it is a base object or an inherited object, when placed into a property grid will be processed based on the attributes defined for each public field. If there is a value in an object that you do not want visible, use the [Browsable] attribute to control visibility. If you have elements in the base class that should never be seen, then just make them non-browsable. If, on the other hand, you want the base class visible when it is in the property grid, but not visible when an inherited object is used is a way different problem. One possible way (which will be a big pain, but will solve your problem) is to have the inherited object be a delegate of the base class. This requires making all public elements in your base class virtual, and in the inherited class you must inherit all elements. The ones that you do not want to polymorph you have the overriden object do nothing else but call the base method. With all public elements inherited, change the visibility scope with their attributes and see if that does the job of controlling things.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups