Hey,
In the page for the color picker found at https://www.infragistics.com/products/windows-forms/data-entry-and-display/color-picker, there's a section on "Customize your Palette".
How do you change those colors? I do not want to add/change/remove what you call custom colors (for which methods in the UltraPaletteInfo do exist), but rather a number of colors in the grid itself. I've found the UltraPaletteInfo has Row and Column properties (which you can add to), but neither of those two have an option to actually add colors.
So eventually, I would like to change my color palette to either of those programmatically.
https://static.infragistics.com/marketing/Website/products/windows-forms/controls/data-entry-and-display/color-picker/color-picker-palettes.png?v=201803200900
Thanks in advance!
Hi Uwe,
You can customize the palette by indexing each row object in the PaletteInfo. I've attached a sample here that demonstrates how to work with palettes by generating a new palette and setting that palette to the Color Picker.
For reference, here is the relevant code:
private void RandomizePalette() { UltraPaletteInfo palette = new UltraPaletteInfo(); int numRows = random.Next(5, 15); int numColumns = random.Next(5, 10); for (int i = 0; i < numColumns; i++) { palette.Columns.Add(); } for (int i = 0; i < numRows; i++) { GridPaletteRow row = palette.Rows.Add(); for (int j = 0; j < numColumns; j++) { row[j] = Color.FromArgb(random.Next(256), random.Next(256), random.Next(256)); } } ultraColorPicker1.PaletteInfo = palette; }
Please look over the sample and let me know if this answers your question.
UltraColorPickerCustomPalette.zip
Hey Mike,
thank you, that works perfectly.