This is a migrated thread and some comments may be shown as answers.

RGB functionality

4 Answers 103 Views
ColorEditor
This is a migrated thread and some comments may be shown as answers.
Jennifer
Top achievements
Rank 1
Jennifer asked on 23 Nov 2011, 04:56 AM
Hi Team,

I would like to know the Color editor RGB functionality logic for Positioning that hue and pad thumbs based on the value entered in the RGB textBoxes.

Thanks,
Jennifer.

4 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 23 Nov 2011, 01:36 PM
Hello Jennifer,

Thank you for contacting us. I am not sure that I fully understand your question. The thumb is updated after you change the R, G or B text boxes, if that is what you're asking. If not, could you please provide more detailed question. I'd be glad to further assist you.

Regards,
Kiril Stanoev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Jennifer
Top achievements
Rank 1
answered on 24 Nov 2011, 05:55 AM
Hello Kiril,

I am trying to implement a colorPicker with sliders same like that of the demo in Telerik site. But I need to integrate the RGB functionality like in the ColorEditor, (I don't want to use the color editor directly). How we can position the hue and pad thumbs based on the values entered in the RGB textBoxes.

Please check the following forum as well.
http://www.telerik.com/community/forums/silverlight/slider/colorpicker-with-rgb.aspx#1885813.


Thanks,
Jennifer.
0
Kiril Stanoev
Telerik team
answered on 24 Nov 2011, 02:03 PM
Hello Jennifer,

Currently this scenario is not supported by ColorEditor and ColorPicker. For our next official release we have plans to integrate RadColorEditor into RadColorPicker and create an advanced section.

Best wishes,
Kiril Stanoev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
newbie
Top achievements
Rank 1
answered on 10 Feb 2012, 08:15 PM
Hi Jennifer,

I doubt that Telerik is going to share their source code with you to show you how to move a control to a color-value-position within a rectangle. Its not a reasonable request because there is quite a bit of logic involved with this.

Anyways, if you don't like the default look and feel of the control you can edit its ControlTemplate and style it the way you want to. The Color Editor control makes use of the ColorEditor ViewModel. You can set the red, green, and/or blue properties of a colour using the RgbaColorViewModel. When you change the red, green, or blue value in this view model, the Telerik (thumb) control used for selecting a color is moved to the correct position within the rectangle.

For example, the following controls are within the ControlTemplate for the RadColorEditor and they are bound to the RgbaColorViewModel's Red, Green and Blue values. I could have used a slider control instead of TextBoxes, but it is easiest to demonstrate how to use the RgbaColorViewModel to set the color of the RadColorEditor.

<Grid Grid.Column="1" Margin="10,0,0,0">
    <Grid>
        <Grid.RowDefinitions>
             <RowDefinition Height="Auto"/>
             <RowDefinition Height="Auto"/>
             <RowDefinition Height="Auto"/>
             <RowDefinition Height="Auto"/>
             <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBox Grid.Row="0" VerticalAlignment="Top"
                        Text="{Binding ViewModel.Rgba.Red, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                        Telerik_Windows_Controls_ColorEditor_Helpers:TextBoxHelper.UpdateTextBindingOnKeyPress="True"/>
        <TextBox Grid.Row="1" VerticalAlignment="Top"
                        Text="{Binding ViewModel.Rgba.Green, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                        Telerik_Windows_Controls_ColorEditor_Helpers:TextBoxHelper.UpdateTextBindingOnKeyPress="True"/>
        <TextBox Grid.Row="2" VerticalAlignment="Top"
                         Text="{Binding ViewModel.Rgba.Blue, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                         Telerik_Windows_Controls_ColorEditor_Helpers:TextBoxHelper.UpdateTextBindingOnKeyPress="True"/>
        <TextBox Grid.Row="4" VerticalAlignment="Top"
                            Text="{Binding ViewModel.Rgba.Alpha, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}
                            Telerik_Windows_Controls_ColorEditor_Helpers:TextBoxHelper.UpdateTextBindingOnKeyPress="True"/>
        <TextBox Grid.Row="3" VerticalAlignment="Top"
                           Text="{Binding ViewModel.Hex.Value, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                            Telerik_Windows_Controls_ColorEditor_Helpers:TextBoxHelper.UpdateTextBindingOnKeyPress="True"/>
    </Grid>
</Grid>



So, essentially you can remove the ComboBox and TextBoxes beside the color picker in it's ControlTemplate and use some other means to set the RGB values (using a slider or something instead).
Tags
ColorEditor
Asked by
Jennifer
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Jennifer
Top achievements
Rank 1
newbie
Top achievements
Rank 1
Share this question
or