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
  1. Home
  2. General Programming
  3. C#
  4. Hide subproperty in PropertyGrid

Hide subproperty in PropertyGrid

Scheduled Pinned Locked Moved C#
csscomhelptutorialquestion
3 Posts 2 Posters 0 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.
  • V Offline
    V Offline
    viciouskinid
    wrote on last edited by
    #1

    I am using the property grid and have it doing most things in need. the property grid is loaded with custom class and i have used ExpandableObjectConverter to display subproperties. I would like to know if there is a way to hide one or more of these subproperties at runtime. In the below link they are doing this with the standard font class. is there a way to do the same with a custom class instead of the font class. http://www.eggheadcafe.com/forumpost.aspx?redirect=forumpostsubmission&topicid=2&forumpostid=10158840#Post10158840[^] an example of my custom class is below: public class CustomClass { CustomClassSubProperty m_ccsp = new CustomClassSubProperty(); public CustomClassSubProperty M_ccsp { get { return m_ccsp ; } set { m_ccsp = value; } } } public class CustomClassSubProperty { string m_s = "Hide Me"; public string S { get { return m_s; } set { m_s = value; } } string m_a = "Show Me"; public string A { get { return m_a; } set { m_a = value; } } } Is there a way I can hide the sub property S in the property grid at runtime? Thanks for the help.

    OriginalGriffO 1 Reply Last reply
    0
    • V viciouskinid

      I am using the property grid and have it doing most things in need. the property grid is loaded with custom class and i have used ExpandableObjectConverter to display subproperties. I would like to know if there is a way to hide one or more of these subproperties at runtime. In the below link they are doing this with the standard font class. is there a way to do the same with a custom class instead of the font class. http://www.eggheadcafe.com/forumpost.aspx?redirect=forumpostsubmission&topicid=2&forumpostid=10158840#Post10158840[^] an example of my custom class is below: public class CustomClass { CustomClassSubProperty m_ccsp = new CustomClassSubProperty(); public CustomClassSubProperty M_ccsp { get { return m_ccsp ; } set { m_ccsp = value; } } } public class CustomClassSubProperty { string m_s = "Hide Me"; public string S { get { return m_s; } set { m_s = value; } } string m_a = "Show Me"; public string A { get { return m_a; } set { m_a = value; } } } Is there a way I can hide the sub property S in the property grid at runtime? Thanks for the help.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Yes - Hiding inherited properties[^] works the same for your own ones.

      You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      V 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Yes - Hiding inherited properties[^] works the same for your own ones.

        You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

        V Offline
        V Offline
        viciouskinid
        wrote on last edited by
        #3

        yeah I can do that but is there anyway i can hide it at runtime. so i can show it if a certain condition and hide not.

        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