Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 360691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:30:47+00:00 2026-05-12T12:30:47+00:00

I’m creating a program where the user has the option of creating their own

  • 0

I’m creating a program where the user has the option of creating their own custom properties that will ultimately be displayed in a PropertyGrid. Right now I don’t want to mess with custom editors, so I’m only allowing primitive type properties (string, int, double, DateTime, bool etc.) that the PropertyGrid already has built in editors for.

However, I also want to give the user the option to create multiple choice properties where they can defined a list of possible values which in turn will show up as a drop down list in the PropertyGrid.

When I hard code an Enum in my code the property grid automatically shows properties of that enum as a drop down list. But can I create and or modify an enumeration at runtime so the user could add another property option, and go back to the PropertyGrid and see their new option in a drop down?

Update

Considering Patricks comment, I’m thinking that Enums are not the right way to go in this case. So instead how can I use a list of strings to populate a drop down in a PropertyGrid item? Would that require a custom editor?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:30:47+00:00Added an answer on May 12, 2026 at 12:30 pm

    The answer is in a simple class: TypeConverter. (and yes, enums are not suitable here).

    Since I have not a lot of details, I will assume that you have a PropertyGrid “linked” to a target instance by the SelectedObject property and that your target instance implements ICustomTypeDescriptor so that you can add properties (i.e. PropertyDescriptors) at runtime. I don’t know your design but if you are not doing like this, I advise you to have a look at it.

    Now let’s say that you add a string property and that you want to let your user specify a set of constraints for this property. Your UI let’s the user enter a set of strings and you get a list of strings as a result. Maybe you keep a dictionary of properties in your target instance so let’s assume this new list is stored there too.

    Now, just write a new converter derived from TypeConverter (or StringConverter maybe in this example). You will have to override GetStandardValuesSupported to return true and GetStandardValues to return the list of strings (use the context parameter to access the Instance property and its list of strings). This converter will be published by your PropertyDescriptor with the PropertyDescriptor.Converter property.

    I hope this is not too nebulous. If you have a specific question on this process, just let me know.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.