I love your controls, but that's a really lame answer which speaks to poor design of this otherwise awesome control. I just ran into this problem, so I threw together a quick behavior that solves this problem. You'll of course need the Blend SDK (or Prism) so you can include a reference to System.Windows.Interactivity.
Usage:
Code:
using System.Windows;
using System.Windows.Input;
using System.Windows.Interactivity;
using Telerik.Windows.Controls;
namespace Ows.Modules.HelloWorld
{
public class ForwardColorToCommand : Behavior<RadColorPicker>
{
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register("Command", typeof (ICommand), typeof (ForwardColorToCommand), new PropertyMetadata(null, (s, e) => { }));
public ICommand Command
{
get { return (ICommand) GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.SelectedColorChanged += OnColorChanged;
}
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.SelectedColorChanged -= OnColorChanged;
}
private void OnColorChanged(object sender, System.EventArgs e)
{
var picker = sender as RadColorPicker;
if (picker == null)
return;
var command = Command;
if (command == null)
return;
var newColor = picker.SelectedColor;
if (command.CanExecute(newColor))
command.Execute(newColor);
}
}
}