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 do I create a ProperyGrid subcategory?

How do I create a ProperyGrid subcategory?

Scheduled Pinned Locked Moved C#
question
3 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.
  • D Offline
    D Offline
    David Fleming
    wrote on last edited by
    #1

    I know that to display a custom control's attribute in a specific category in the PropertyGrid you use:

    [Browsable(true), Category("SomeCategory"), Description("Some info....")]

    What I would like to do is have one overriding category for my control's attributes (such as "Control Specific") and then have subcategories for more specific things (such as "Colors"). Sort of like under "Appearance" there is "Font". How do I do that? Thanks.

    T V 2 Replies Last reply
    0
    • D David Fleming

      I know that to display a custom control's attribute in a specific category in the PropertyGrid you use:

      [Browsable(true), Category("SomeCategory"), Description("Some info....")]

      What I would like to do is have one overriding category for my control's attributes (such as "Control Specific") and then have subcategories for more specific things (such as "Colors"). Sort of like under "Appearance" there is "Font". How do I do that? Thanks.

      T Offline
      T Offline
      TJoe
      wrote on last edited by
      #2

      In short, you can't define a sub-category. You can have properites be expandable though. In your example, the Appearance property would be of type (say) MyAppearance. MyAppearance type would define it's TypeConverter as ExpandableObjectConverter[^]. Then MyAppearance's properties would be shown in the PropertyGrid (which would include a Font property). This[^] article describes how to use ICustomTypeDescriptor (which allows you to dynamically change what is shown in the PropertyGrid) and ExpandableObjectConverter.

      Take care, Tom ----------------------------------------------- Check out my blog at http://tjoe.wordpress.com

      1 Reply Last reply
      0
      • D David Fleming

        I know that to display a custom control's attribute in a specific category in the PropertyGrid you use:

        [Browsable(true), Category("SomeCategory"), Description("Some info....")]

        What I would like to do is have one overriding category for my control's attributes (such as "Control Specific") and then have subcategories for more specific things (such as "Colors"). Sort of like under "Appearance" there is "Font". How do I do that? Thanks.

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

        Hi David, As Tom explained, with the Microsoft PropertyGrid, you can't create subcategories. You can only create kind of container-like properties that you publish with a custom type descriptor. If a commercial product is an option for you, only Smart PropertyGrid.Net is able to create true subcategories. Best regards, Nicolas Cadilhac @ VisualHint Smart PropertyGrid.Net Microsoft PropertyGrid Resource List Free PropertyGrid for MFC Smart FieldPackEditor.Net / DateTimePicker

        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