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.