ColorEditBox, can it work in RGBA mode?

Editors for WPF Forum

Posted 1 year ago by Brian Pratt
Version: 22.1.4
Avatar

I need the ARGB of color picker to show and output RGBA hex values.  Is this possible?

It's easy to convert the color picker value to RGBA, but I want it to show RGBA as well

Thanks,

Brian

Comments (3)

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Brian,

Just to make sure we're on the same page, are you referring to the ColorEditBox control or the ColorPicker control, or a different one?


Actipro Software Support

Posted 1 year ago by Brian Pratt
Avatar

I'm using the ColorEditBox, but am up for different options

Answer - Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Brian,

If you make a class that inherits ColorEditBox, you will have to do several things.

  1. Override the GenerateParts method.  Its base implementation will return parts in ARGB order.  You'll have to modify the result.
  2. Override the ConvertToString method, which is coded to convert a Color value to #ARGB text.
  3. Override the TryConvertFromString method, which is coded to convert #ARGB text to a Color value.

If you do those things, I think the edit box portion should work.

You'd may also have clone our default ColorPicker control Style and make a tweaked one for your needs if the default one won't work.  You can then assign your custom Style to the editBox.PopupPickerStyle property.

I hope that helps!


Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.