How to provide custom color name for ColorEditBox

Editors for WPF Forum

Posted 7 years ago by Dariusz Wąsacz
Version: 12.2.0570
Platform: .NET 4.0
Environment: Windows 8 (64-bit)
Avatar

I'm developing a ColorEditBox which provides standard colors palette in addition to the color picker (Actipro's ColorEditor). I will allow users to quickly choose one of a few standard colors and still to be able to choose any color using color picker. I'd like to display standard color name in case user chose standard color and the color code (#RRGGBB) in case of a free choice.

I derived my control from ColorEditBox and provided its Style to change ColorEditorStyle to have my customized control for choosing colors. I've overridden ConvertToString and ConvertFromString methods - however they are never called. I also tried to provide my coverter as StringValueConverter - also no method from this converter is called.

The problem is:

How can provide my own method for displaying color names in the ColorEditBox?

Comments (3)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Dariusz,

Unfortunately at this time all the conversion done for determining the rendered string value is done within an internal ColorHelper class.  It's converting it to something that it knows it can convert back from (the # syntax).  There aren't any options right now to render color names.

The ConvertToString and ConvertFromString methods end up getting used by automation peers instead.

That all being said, if you are modifying the template for ColorPart, you might be able to add color name support by using a custom IValueConverter in your binding to the editors:MaskedTextBox. Then you would convert the StringValue to and from a color name as appropriate.  We haven't tried that though so I'm not sure if it would work.

I'll log your request for adding support for known color name support.


Actipro Software Support

Posted 7 years ago by Dariusz Wąsacz
Avatar

Thank you for your answer. I have additional questions:

1. I might try to modify ColorPart template. However:

  1a. Do ColorPart templates vary from theme to theme?

  1b. Could you provide the standard template for ColorPart for me to modify?

2. When could I expect native Actipro support for custom color names?

[Modified 7 years ago]

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Dariusz,

1a) No I think the template is the same for all themes.  We just alter the assets (brushes, etc.) that are referenced by the template.

1b) I believe you have WPF Studio, so you can download them right from your account.

2) We marked down the feature request but there are a lot of higher priority features we're working on at the moment, so I can't really offer a target date at this time.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.