In the UltraColorPicker, I would like the text to display the hex code (i.e. #FF0000) rather than the RGB (i.e. 255, 34, 170). I can enter a hex code and it accepts it just fine, but then after validation it displays as RGB. Is it possible to have it display as the hex value?
Hello Infragistics User,
This is achievable by using an IEditorDataFilter for the DataFilter of the UltraColorPicker control. Using the EditorDataFilterConvertArgs of the IEditorDataFilter’s Convert method, you can catch the conversion from editor to display and convert the RGB color code to a hex one to be displayed.
I am attaching a sample project to demonstrate the above. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
ColorPickerHexDisplayTest.zip
That is exactly what I was after. Thank you so much Andrew!
It occurred to me that since the control already allows you to enter an HTML color into the control that you don't even need the DataFilter to handle DisplayToEditor. The control already does that, and does it better. So you could comment out that entire case and just handle EditorToDisplay and that's really all you need.
Commenting out the DisplayToEditor case results in the same behavior as I'm trying to get away from. Entering #FF0000 in the editor displays "Red" after validation.
Hm, that's odd. I guess what's happening there is that the internal conversion is getting the built-in Named color instead of the custom color object you created. I didn't realize you didn't want the named colors.