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. Dynamically add a property item to Property Grid

Dynamically add a property item to Property Grid

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

    I am trying to add propertyitem dynamically to property grid. For example If I want to add a property Item Like a text box which takes "String name" as variable how to add dynamically to property Grid? I can do the following to add the "name" text box at static design time: public class PropertyGridProcessDesigner { [Editor(typeof(PropertyGridProcessDesigner), typeof(System.Drawing.Design.UITypeEditor))] public string Name { get { return name; } set { name= value; } } } But how to achieve the same above thing at run time ? Do we need to create dynamic classes to add Property Item ? If so, can anyone please share any information you have ? Thanks, rajan

    V 1 Reply Last reply
    0
    • V Varad_Rajan

      I am trying to add propertyitem dynamically to property grid. For example If I want to add a property Item Like a text box which takes "String name" as variable how to add dynamically to property Grid? I can do the following to add the "name" text box at static design time: public class PropertyGridProcessDesigner { [Editor(typeof(PropertyGridProcessDesigner), typeof(System.Drawing.Design.UITypeEditor))] public string Name { get { return name; } set { name= value; } } } But how to achieve the same above thing at run time ? Do we need to create dynamic classes to add Property Item ? If so, can anyone please share any information you have ? Thanks, rajan

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

      Rajan, The Microsoft PropertyGrid does not allow you to add a new property to the grid in a few lines of code. Instead you must use various techniques to publish dynamically a set of PropertyDescriptors. The most famous article to do that is: http://www.codeproject.com/KB/miscctrl/bending_property.aspx. If a third party component is an option, only Smart PropertyGrid enables you to call properties like AppendProperty. 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