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

  • Home
  • SEARCH
  • 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 3330712
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:31:00+00:00 2026-05-17T23:31:00+00:00

I have a custom UITypeEditor that is in use for Colour Selection with my

  • 0

I have a custom UITypeEditor that is in use for Colour Selection with my program using the propertygrid, but I can’t seem to get it to activate if I just expose system.drawing.color. I need to wrap the Color with a CustomType before it will invoke my UITypeEditor.

Note the Property TheColour it works. The Colour doesn’t.

When I open the propertyGrid, I can see GetEditStyle is called via both methods, but when it comes to EditValue it is only called when you select TheColour in the propertygrid. The Normal Colour dropdown is shown when you select Colour Property

What am I missing?

<CategoryAttribute("Order Colour"), _
 Browsable(True), _
 DisplayName("The Colour"), _
 Description("The background colour for orders from this terminal"), _
EditorAttribute(GetType(IKMDependency.ColourSelectorEditor), _ 
GetType(System.Drawing.Design.UITypeEditor))> _
Public Property TheColour() As MyColour
    Get
        Return mMyColor
    End Get
    Set(ByVal value As MyColour)
        If value.Colour <> mMyColor.Colour Then
            mColor = value.Colour
            mMyColor = value
            mIsDirty = True
        End If
    End Set
End Property

<CategoryAttribute("Order Colour"), _
 Browsable(True), _
 DisplayName("Colour"), _
 Description("The background colour for orders from this terminal"), _
EditorAttribute(GetType(IKMDependency.ColourSelectorEditor), _ 
GetType(System.Drawing.Design.UITypeEditor))> _
Public Property Colour() As Color
    Get
        Return mColor
    End Get
    Set(ByVal value As Color)
        If mColor <> value Then
            mColor = value
            mMyColor = New MyColour(mColor)
            mIsDirty = True
        End If
    End Set
End Property
  • 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-17T23:31:01+00:00Added an answer on May 17, 2026 at 11:31 pm

    The problem is that it is noticing that the associated TypeConverter supports enumerated values. We need to disable that; note we can also inherit from the default implementations to get things like the color preview painting (examples in C#, but should be easy to translate):

    class MyColorEditor : ColorEditor {
        public override UITypeEditorEditStyle GetEditStyle(
            ITypeDescriptorContext context) {
             return UITypeEditorEditStyle.Modal;
        }
        public override object  EditValue(
           ITypeDescriptorContext context, IServiceProvider provider, object value) {
            MessageBox.Show(
                  "We could show an editor here, but you meant Green, right?");
           return Color.Green;
        }
    }
    class MyColorConverter : ColorConverter { // reference: System.Drawing.Design.dll
        public override bool GetStandardValuesSupported(
                ITypeDescriptorContext context) {
            return false;
        }
    }
    class TestObject
    {
        [Category("Order Colour"), Browsable(true), DisplayName("Colour")]
        [Description("The background colour for orders from this terminal")]
        [Editor(typeof(MyColorEditor), typeof(UITypeEditor))]
        [TypeConverter(typeof(MyColorConverter))]
        public Color Colour {get;set;}
    }
    

    If you want this to apply to all Color properties, there is also a way to do it such that you don’t need to decorate every property; somewhere during your app’s initialization code, execute:

    TypeDescriptor.AddAttributes(typeof(Color),
        new EditorAttribute(typeof(MyColorEditor), typeof(UITypeEditor)),
        new TypeConverterAttribute(typeof(MyColorConverter)));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have custom event that has several different subscribers who will all use the
I have custom component that I can place in my layout file (XML) for
I have custom slider that I use the following touch event to respond to:
I have custom checkstyle checks file (called checks.xml), and I'm trying to use that
I have custom classes that I currently instantiate within App.xaml as resources. I want
We have custom headers in the Silverlight DataGrid using the ContentTemplate. We've got a
I have custom gallery. Gallery represents items that are frame layout. There are one
I have an custom control that represents a grid; and implements another custom control.
I have custom groupViews that need to change state when they are expanded and
I have custom radar tiles that I am trying to overlay over Google Maps

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.