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 dynamically add a "CheckBox" or "List Box " property Item to a Property Grid at runtime ?

How to dynamically add a "CheckBox" or "List Box " property Item to a Property Grid at runtime ?

Scheduled Pinned Locked Moved C#
graphicstutorialcssdesignquestion
1 Posts 1 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 have a requirement to add dynamically a list box or checkbox to a propertygrid at runtime. I do not know at compile time what type of property items to be added to property Grid. I am able to achieve to add dynamically a simple property item like a text by overriding the "PropertyDescriptor" Class in my customdescriptor class. But how to add in similar way a checkbox or listbox to propertygrid dynamically ? I was not successfull till now. But I can achieve the same thing for example adding a checkbox property item at compile time(without overriding PropertyDescriptor) by using UiTypeEditor like: public class CheckBoxTest : System.Drawing.Design.UITypeEditor { public override bool GetPaintValueSupported(ITypeDescriptorContext context) { return true; } public override void PaintValue(System.Drawing.Design.PaintValueEventArgs e) { System.Windows.Forms.ControlPaint.DrawCheckBox(e.Graphics, e.Bounds, ((CustomProperty)e.Context.Instance).checkValue ? ButtonState.Checked : ButtonState.Normal); } } But If I try to achieve the above to be executed at runtime by overriding "PropertyDescriptor" These functions are not called. Can anyone have any idea ? Thanks, Rajan

    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