RGB functionality

5 posts, 0 answers
  1. Jennifer
    Jennifer avatar
    9 posts
    Member since:
    Oct 2011

    Posted 22 Nov 2011 Link to this post

    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.
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 23 Nov 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Jennifer
    Jennifer avatar
    9 posts
    Member since:
    Oct 2011

    Posted 23 Nov 2011 Link to this post

    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.
  5. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 24 Nov 2011 Link to this post

    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 >>

  6. newbie
    newbie avatar
    15 posts
    Member since:
    Oct 2010

    Posted 10 Feb 2012 Link to this post

    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).
Back to Top
DevCraft banner