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 3283584
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:03:30+00:00 2026-05-17T20:03:30+00:00

I want to assign a custom editor to a boolean property in a PropertyGrid

  • 0

I want to assign a custom editor to a boolean property in a PropertyGrid. I’m using the standard propertygrid (from namespace System.Windows.Forms). It is possible to assign custom editors to properties using the UITypeEditor class. However, as far as I can see, it is not possible to use it for a boolean property.

I’ve tried to solve it by overriding the property grid so I can add items manually. I can add a string property that has a custom editor by the following piece of code:

Properties.Item.Add("My Custom Editor", "", false, "Properties with custom UITypeEditor", "The component accept custom UITypeEditor.", true);
Properties.Item[Properties.Item.Count - 1].CustomEditor = new MyEditor();

So far so good, a custom editor appears (with a button in the grid). However, when I change the type to boolean by setting the default value on false (see below), the button to open the custom editor doesn’t appear. Instead, a dropdown menu with true/false appears.

Properties.Item.Add("My Custom Editor", false, false, "Properties with custom UITypeEditor", "The component accept custom UITypeEditor.", true);
Properties.Item[Properties.Item.Count - 1].CustomEditor = new MyEditor();

Does anyone has a solution for this?

Thanks in forward!

Regards,
Peter

  • 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-17T20:03:31+00:00Added an answer on May 17, 2026 at 8:03 pm

    The Microsoft PropertyGrid checks this flag to determine if it displays a dropdown arrow (flag == true) or a modal button (flag == false):

    bool flag = gridEntryFromRow.NeedsDropDownButton | gridEntryFromRow.Enumerable;
    

    The first part is true if the UITypeEditor style is DropDown and the second part is true if the attached TypeConverter’s GetStandardValuesSupported returns true.

    You can check all this in PropertyGridView.SelectRow in Reflector.

    If you are able to attach a custom TypeConverter to your boolean (I would derive it from BooleanConverter) whose GetStandardValuesSupported method is overriden to return false, then you will get your modal button. Of course you loose the standard values (double clicking won’t cycle the values for example), this is a tradeoff. I have identified this issue a long time ago and that’s why in my own PropertyGrid I am not so strict and will enable a modal editor even if standard values are defined as long as I attach a ForceEditor attribute to the property.

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

Sidebar

Related Questions

I want to add new custom SQL Server Role and assign the new users
I want to assign a class to the list-items of an ul li list
I have an asp:datasource select query that returns a sum. I want to assign
I want to display the records from db table..I am doing this by the
I have two 50 x 6 matrices, say A and B . I want
I get requestParameters Map from my app and assigning it to a different map
I have made an application in javascript using HTML fields in asp.net, as asp
I am developing an app where I need to show a count. This count
we use a hadoop multi-node setup on debian + ubuntu with the latest stable
I have 10 sites currently on my server with cpanel. Currently they are all

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.