Selected Color Binding

3 posts, 1 answers
  1. Ez
    Ez avatar
    5 posts
    Member since:
    Dec 2008

    Posted 10 May 2009 Link to this post

    I'd like to set the selectedColorProperty of the radColorPicker to be bound to a value.

    I need the binding mode to be twoWay.

    This is the code I am using:


    var fg = new Binding("TextBlockForeground");


    fg.Source = cStyles;

    fg.Converter = cc;   (WHERE cc returns a SolidColorBrush.Color)

    fg.Mode =




    RadColorPicker.SelectedColorProperty, fg);

    When the color picker loads and when I select a color, the value that it is bound to updates correctly, however, the chosen color represented in the colorpicker's icon is not updated.

    Is this a bug?



  2. Answer
    Valentin.Stoychev avatar
    2198 posts

    Posted 11 May 2009 Link to this post

    Hi Ez,

    We need some help in order to reproduce the problem. we tried with the following code and all seems to work just fine:
    Code Behind:
            private Color p = Colors.Brown;  
            public Page()  
                var fg = new Binding("TextBlockForeground");   
                fg.Source = this;  
                fg.Mode = BindingMode.TwoWay;  
                RadColorPicker1.SetBinding(RadColorPicker.SelectedColorProperty, fg);  
            public Color TextBlockForeground  
                    return this.p;  
                    this.p = value;  

    <UserControl x:Class="SilverlightApplication10.Page" 
        Width="400" Height="300">  
        <Grid x:Name="LayoutRoot" Background="White">  
                <telerikInput:RadColorPicker x:Name="RadColorPicker1"></telerikInput:RadColorPicker> 

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Ez
    Ez avatar
    5 posts
    Member since:
    Dec 2008

    Posted 13 May 2009 Link to this post

    It seems as if the issue was that I was using a converter to convert the "selectedColor" string into a Media.Color for the color picker.

    I turned the converter off, and all works fine.

    Thanks for your help.

Back to Top