I've successfully swapped out the XamColorPicker's CurrentPalette by binding it to a different ColorPallete. But, when I go to my dropdown, I still see the default color pallete in my list of selectable palettes. I want this palette gone, as I have an explicit set of valid colors. How can I remove/hide this default palette from my collection?
Hi Timothy,
Thank you for your replies. I am glad that you have managed to resolve your issue.
I wanted to post pictures to better summarize my issue, but I have to find somewhere to host them. If you need more explanation, let me know. As far as I'm concerned, this issue is closed.
I've got it sorted out. Sorry for the code formatting. Uploading Xaml here is a pain.
My initial problem:
There exists a Color Palette within my Color Palette Combo box that I did not place there. This Color palette is the default color palette infragistics provides. It is visible in my control, even though I do not intend it to be there. As you can see, I've bound the current palette to a color palette defined in the Resource Section. The 2nd palette, I would like to be a palette full of the color teal. I only want 2 palettes.
Bad Code:
<ig:XamColorPicker CurrentPalette="{Binding Source={StaticResource ColorPalette1}}" > <ig:XamColorPicker.ColorPalettes>
<ig:ColorPalette>
<ig:ColorPalette.Colors>
<ig:ColorPatchCollection>
<ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/> <ig:ColorPatch Color="#FF00FFFF"/>
</ig:ColorPatchCollection>
</ig:ColorPalette.Colors>
</ig:ColorPalette>
</ig:XamColorPicker.ColorPalettes> </ig:XamColorPicker>
My Solution:
Place both palettes in the static resource section. When building the colorpicker's Palette collection, instantiate a new palette collection with only the 2 palettes defined.
Working Code:
<UserControl.Resources>
<ig:ColorPalette x:Key="ColorPalette1">
<ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/> <ig:ColorPatch Color="#FF000000"/>
</ig:ColorPalette> <ig:ColorPalette x:Key="ColorPalette2">
</UserControl.Resources>
<ig:XamColorPicker.ColorPalettes>
<ig:ColorPaletteCollection>
<StaticResource ResourceKey="ColorPalette1"/> <StaticResource ResourceKey="ColorPalette2"/>
</ig:ColorPaletteCollection>
</ig:XamColorPicker.ColorPalettes>
Hi Timothy
Thank you for your post. I was looking into your requirement and I cannot understand which palette exactly you would like to hide: Current Color Palette, Derived Color Palette or Recent Color Palette.
Looking forward to hearing from you.