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. How to hide property @ Runtime

How to hide property @ Runtime

Scheduled Pinned Locked Moved C#
designhelptutorialquestion
5 Posts 3 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
    Vertyg0
    wrote on last edited by
    #1

    Is there any better way to hide property runtime other than [BrowsableAttribute(false)] ? There is only PreFilterProperties for Design mode but I couldn`t find anything like this for runtime, anyone can help me out?

    M 1 Reply Last reply
    0
    • V Vertyg0

      Is there any better way to hide property runtime other than [BrowsableAttribute(false)] ? There is only PreFilterProperties for Design mode but I couldn`t find anything like this for runtime, anyone can help me out?

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello, I think I do not understand the question. :confused:

      Vertyg0 wrote:

      hide property runtime other than [BrowsableAttribute(false)]

      I allways thought, that the BrowsableAttribute effects design time. If you do not whant to have an effect by changing a property during runtime, maybe you can use a if(DesignMode) //is a Member of System.ComponentModel.Component { } in your set accessor of the property. Hope that helps you. All the best, Martin

      V 1 Reply Last reply
      0
      • M Martin 0

        Hello, I think I do not understand the question. :confused:

        Vertyg0 wrote:

        hide property runtime other than [BrowsableAttribute(false)]

        I allways thought, that the BrowsableAttribute effects design time. If you do not whant to have an effect by changing a property during runtime, maybe you can use a if(DesignMode) //is a Member of System.ComponentModel.Component { } in your set accessor of the property. Hope that helps you. All the best, Martin

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

        I want to hide property. For instance i want to hide Text property so that it doesnt show up in PropertyGrid at runtime.

        V 1 Reply Last reply
        0
        • V Vertyg0

          I want to hide property. For instance i want to hide Text property so that it doesnt show up in PropertyGrid at runtime.

          V Offline
          V Offline
          visualhint
          wrote on last edited by
          #4

          At runtime, there is no direct way to hide a property. But you could use some methods presented in some of the articles here on CodeProject to manage the set of displayed properties. For example, the PropertyBag can allow you to choose what properties are displayed at runtime. More generally speaking, if you have a class derived from ICustomTypeDescriptor that publishes a set of PropertyDescriptors, you can choose to temporarily remove one of the properties. Hope that helps.

          Best regards, Nicolas Cadilhac Smart PropertyGrid.Net @ VisualHint Microsoft PropertyGrid Resource List Free PropertyGrid for MFC

          V 1 Reply Last reply
          0
          • V visualhint

            At runtime, there is no direct way to hide a property. But you could use some methods presented in some of the articles here on CodeProject to manage the set of displayed properties. For example, the PropertyBag can allow you to choose what properties are displayed at runtime. More generally speaking, if you have a class derived from ICustomTypeDescriptor that publishes a set of PropertyDescriptors, you can choose to temporarily remove one of the properties. Hope that helps.

            Best regards, Nicolas Cadilhac Smart PropertyGrid.Net @ VisualHint Microsoft PropertyGrid Resource List Free PropertyGrid for MFC

            V Offline
            V Offline
            Vertyg0
            wrote on last edited by
            #5

            PropertyBag could be interesting thank you !

            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