This project has moved. For the latest updates, please go here.

ReTemplate the ColorPicker and PropertyGrid element

Oct 22, 2013 at 7:29 AM
Hi everyone,

I've some problem for my development. I hope you can help me.

I would like to change the theme of the ColorPicker and PropertyGrid tools. So, after some researches, I've seen that I must re-write the XAML files.
For example, I would like to change the language of the ColorPicker element (Advanced, Available colors, Standard Colors...).

Do you have any solutions for my problems ?
If I have to re-write XAML files, how to apply them ?

Thanks a lot
Oct 22, 2013 at 12:23 PM

If you only want to change the text in the colorPicker, you can modify them in Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml (for Windows8) or Generic.xaml (Windows7).

If you want to create a new theme for the ColorPicker, you need to re-write XAML files with an implicit style for the ColorPicker, something like:

 <ControlTemplate x:Key="ColorPickerTemplate"
                    TargetType="{x:Type xctk:ColorPicker}">
     <!-- Put the ColorPicker Template available in Toolkit/ColorPicker/Themes/Aero2.NormalColor.xaml and change whatever you want-->

 <Style x:Key="ColorPickerStyle"
          TargetType="{x:Type xctk:ColorPicker}">
    <Setter Property="Background"
              Value="Blue" />
   <Setter Property="Template"
              Value="{StaticResource ColorPickerTemplate}" />

<!-- The implicit ColorPicker style -->
<Style TargetType="{x:Type xctk:ColorPicker}"
          BasedOn="{StaticResource ColorPickerStyle}" />

and include this ResourceDictionary xaml file in App.xaml, something like this ;
            <ResourceDictionary Source="xxxx.xaml" /> <!-- your xaml file -->
Oct 22, 2013 at 12:51 PM
Thanks a lot.

But, this solution (rewirte Aero2.NormalColor.xaml) works only if you download the source project and include this in your code.
However, I would not modifiy the DLL of this project for my own use, and do this in my code.

Is it possible ?
Oct 22, 2013 at 1:59 PM

I you want to rewrite the xaml of the colorPicker, you will have to use the current ColorPicker and adapt it to your needs.
To do so, you will have to download the code and copy the Style/Template of the colorPicker (from Aero2.NormalColor.xaml) and paste it into your own code. It is the only thing you will do with the dowloaded code. You can then modify the pasted code. You will still work with the dll of the toolkit.

Good luck :-)
Oct 22, 2013 at 2:49 PM

Yes of course, this solution works, but if I want the newest version in many month, these modification will be lost...
So, except this solution, there is no way to do that ?
Oct 22, 2013 at 4:46 PM

I see your point. Currently, there are no other options, but you can create an issue on this site and we will look forward for a solution.
Oct 23, 2013 at 10:05 AM

Thanks for your time.
An issue has been created for this amelioration.

I think that it is possible with resources files, like AvalonDock element !