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. Category attribute in Property Grid

Category attribute in Property Grid

Scheduled Pinned Locked Moved C#
cssquestion
4 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
    Varad_Rajan
    wrote on last edited by
    #1

    Is it possible to expand a particular category and collapse another particular category in property Grid ? How can we do it. Also if I do not have category , MISC is shown as category . Is it possible to remove "Misc" Thanks , Rajan

    L S 2 Replies Last reply
    0
    • V Varad_Rajan

      Is it possible to expand a particular category and collapse another particular category in property Grid ? How can we do it. Also if I do not have category , MISC is shown as category . Is it possible to remove "Misc" Thanks , Rajan

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      No, not AFAIK.

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      V 1 Reply Last reply
      0
      • L leppie

        No, not AFAIK.

        xacc.ide - now with TabsToSpaces support
        IronScheme - 1.0 alpha 4a out now (29 May 2008)

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

        Ok.. I need to expand all category or collapse all. I need to change the category name of "MiSC" to some thing meaningful Thanks

        1 Reply Last reply
        0
        • V Varad_Rajan

          Is it possible to expand a particular category and collapse another particular category in property Grid ? How can we do it. Also if I do not have category , MISC is shown as category . Is it possible to remove "Misc" Thanks , Rajan

          S Offline
          S Offline
          Scott Dorman
          wrote on last edited by
          #4

          Those category names come from the System.ComponentModel.CategoryAttribute that decorate the public properties of the object being displayed in the property grid. Generally, the "Misc" category holds those properties that don't have this attribute. If you are displaying an object of your own making, then you need to add the attribute, which will move them out of "Misc". If you want to "move" other (inherited) properties, you need to override or hide them and change the attribute accordingly. To expand categories you can do this:

          PropertyGrid pg = new PropertyGrid();
          pg.ExpandAllGridItems(); // Expands all the categories in the System.Windows.Forms.PropertyGrid
          pg.CollapseAllGridItems(); // Collapses all the categories in the System.Windows.Forms.PropertyGrid

          // To expand/collapse a specific category
          GridItem gi = pg.SelectedGridItem;
          if (gi.GridItemType == GridItemType.Category)
          {
          gi.Expanded = true;
          }

          Scott Dorman

          Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai


          [Forum Guidelines][Articles][Blog]

          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