There are diverse color pickers on the net (see e.g. the framework sample, a more elaborate sample on CodeProject, Telerik’s commercial version…) but none of them were really what I was looking for, so I set aside a few hours to cook something myself. The color picker I was looking for had to be flexible and templated, support both solid colors and gradients. The screenshot below shows some of the templates I assembled:
This custom WPF control is a standard example of databinding, control templating, routed events, dependency properties and XAML fun. Looking at the code of commercial controls I wonder why they make things so complicated sometimes…
![]() |
Color Picker 1.6 (Tue 27 Apr 2010) |







Thank you, çois !
Thak you.
Thank you.
But How do you do if you want to save color´s values in an xml.
This xml could be a config file.
save normal Color´s values in an xml is easy, but saving gradients or semitransparents colors is , is…I don know how to do.
Fairly easy. Use XamlWriter.Save(SomeBrush) to save to a XAML string and XamlReader.Parse(XamlString) to read an XML string (representing a gradient brush).
Thanks dude, very handy. Have you thought of ways to package both the templates and classes together so that in the future you can simply add a reference to your color picker library and and use it without manually adding the resources?
the link is broken
Fixed, thanks a bunch for letting know!