Add Text to Color picker

5 posts, 0 answers
  1. Akram
    Akram avatar
    45 posts
    Member since:
    Dec 2012

    Posted 26 Dec 2012 Link to this post

    Hi
    how can i Add Text to Color picker without removing the underline color postion.

    if i use the RadColorPicker.Content then the under line color postion removed.

    please let me know if you understand what i mean

    Thanks,
    Akram
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 27 Dec 2012 Link to this post

    Hi Akram,

     Could you please check out our First Look demo and let us know if the suggested approach is suitable for you? We have predefined the default ContentTemplate of the RadColorPickers in the Demo to achieve the Letters A, T, H etc:

    <telerik:RadColorPicker x:Name="textForegroundPicker"  
                        RecentColorsVisibility="{Binding IsRecentColorsVisible, Converter={StaticResource booleanToVisibilityConverter}}"
                                        RecentColorsItemsSource="{Binding ColorHistory}"
                                        SelectedColor="{Binding CurrentColor, Mode=TwoWay}">
                    <telerik:RadColorPicker.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Height="20" Width="18" Margin="-2">                        
                                <Image Source="../Images/ColorPicker/FirstLook/TextColor.png"/>
                                <Rectangle Height="2" Width="18"
                                        Fill="{Binding SelectedColor, ElementName=textForegroundPicker, Converter={StaticResource colorToBrushConverter}}" />
                            </StackPanel>
                        </DataTemplate>
                    </telerik:RadColorPicker.ContentTemplate>
                    <telerik:RadColorPicker.AdditionalContent>
                        <ContentControl HorizontalContentAlignment="Stretch" ContentTemplate="{StaticResource MoreColorsTemplate}"
                                Content="{Binding}" />
                    </telerik:RadColorPicker.AdditionalContent>
                </telerik:RadColorPicker>

    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Akram
    Akram avatar
    45 posts
    Member since:
    Dec 2012

    Posted 27 Dec 2012 Link to this post

    Thanks, that's worked for me but the problem is that i need to write more code for each color picker.

    Thanks,
    Akram
  5. Jeramy
    Jeramy avatar
    12 posts
    Member since:
    Sep 2015

    Posted 17 Sep 2015 in reply to Petar Mladenov Link to this post

    Disclaimer - I am new to Telerik and WPF. This isn't working for me - I get the following error: "Error 35 The resource "colorToBrushConverter" could not be resolved."

    Here's what I have in my XAML....

    <telerik:RadColorPicker Content="" x:Name="FillColorPicker" SelectedColor="Black">
                        <telerik:RadColorPicker.ContentTemplate>
                            <DataTemplate>
                                <Rectangle Height="10" Width="18" Fill="{Binding SelectedColor, ElementName=FillColorPicker, Converter={StaticResource colorToBrushConverter}}"/>
                            </DataTemplate>
                        </telerik:RadColorPicker.ContentTemplate>
                    </telerik:RadColorPicker>​

  6. Jeramy
    Jeramy avatar
    12 posts
    Member since:
    Sep 2015

    Posted 17 Sep 2015 in reply to Jeramy Link to this post

    I figured out that I was missing this....

    <Grid.Resources>
        <telerik:ColorToBrushConverter x:Key="colorToBrushConverter" />
    </Grid.Resources>

    Guess I should've waited a little longer to post. :-/

Back to Top
UI for WPF is Visual Studio 2017 Ready