Is there a way to have the Derived palettes of the color picker be reversed?
For example, I have a color Picker with a DerivedPalettesCount of 10, and I am using a Custom Palette with a color of "blue". When this displayes, the derived palette ranges from blue to nearly black.
What I am wanting is the current palette to have the primary color "Blue" but the derived palette to range from a light blue to a "dark blue", with the primary color "blue" being at derived palette position 5. If I pick a color for the palette that is lighter (so i can get the right range of colors) that lighter color appears in the current color palette - We want the darker color there.
Hi Rod,
I'm taking a look to see how you can achieve this. I will update you by Wednesday the latest or if I have any questions for you I will let you know before then.
The colors in the derived palettes are colors that are added depending on the current color strip that is active. These colors are added in code within the assembly and the control doesn't expose them to the user. I'm not sure I 100% understand what you're looking for but I've written some code that will reverse the color strips in the derived palettes section by traversing the visual tree and modifying the stack panel that contains these colors.
void ReverseDerivedPalettes(XamColorPicker picker) { Popup popup = (Popup)Infragistics.Windows.Utilities.GetDescendantFromType(picker, typeof(Popup), true); StackPanel panel = (StackPanel)Infragistics.Windows.Utilities.GetDescendantFromName(popup.Child, "DerivedPalettes"); List<UIElement> c = new List<UIElement>(); // Reverse the list. for (int i = panel.Children.Count - 1; i >= 0; i--) { c.Add(panel.Children[i]); } // clear the stack panel list. panel.Children.Clear(); // Re-add the reversed items. for (int i = 0; i < c.Count; i++) panel.Children.Add(c[i]); }
Make sure to run this code after the the XamColorPicker has finished loading so everything will be in the visual tree.
That isnt quite what we are looking for.
Currently, if you have a color, the derived colors shade from the specified color to a darker shade of the color. But the color at the top of the derived pallete is the specified color.
For example:
Current Color pallete:
Red Yellow
Derived Color Palletes:
Darker red Darker Yellow
Even Darker red Even Darker Yellow
What we want is
... ...
Even Lighter Red Even Lighter Yellow
Lighter red Lighter Yellow
Unfortunately, doing something like this is currently not possible unless you modify the source code for the XamColorPicker. The derived color palettes are all generated internally and managed internally. About the best you could do is make it visually look the way you want by modifying the StackPanel that has all the ColorStrips but selection wouldn't work right since it's handled by the ColorStripManager inside the color picker. This object uses the internal keyword so it can't be accessed through the color picker outside of the assembly.
If you're okay with modifying the source code then you will have complete control over the colors that are added. Inside the XamColorPicker class is a private method called EnsureDerivedColorStrips and in here is where you can find the code that generates the derived color palettes.
Since what you're trying to do can't be achieved without modifying the source code I've logged this as a new product idea for the XamColorPicker. I have sent your product idea directly to our product management team. Our product team chooses new product ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your feature is chosen for development, you will be notified at that time. Your reference number for this product idea is PI12110035.
If you would like to follow up on your product idea at a later point, you may contact Developer Support management via email. Please include the reference number of your product idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Did you have any other questions regarding this issue?
Thank you very much for the feedback. I have forwarded your feedback to our product management team.
A Product Idea? Please take a minute and go to Microsoft word / Excel / Outlook and have a look at their color selector. If you look, most of their colors gradiate from light to dark, (the first 3 do not) but the rest are displayed how we are wanting them. the color at the very top is the 2nd from the bottom in the transition colors.