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

Add Text to Color picker

4 Answers 220 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Akram
Top achievements
Rank 1
Akram asked on 26 Dec 2012, 05:17 PM
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

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 27 Dec 2012, 08:06 AM
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.

0
Akram
Top achievements
Rank 1
answered on 27 Dec 2012, 01:10 PM
Thanks, that's worked for me but the problem is that i need to write more code for each color picker.

Thanks,
Akram
0
Jeramy
Top achievements
Rank 1
answered on 17 Sep 2015, 09:23 PM

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

0
Jeramy
Top achievements
Rank 1
answered on 17 Sep 2015, 09:33 PM

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. :-/

Tags
ColorPicker
Asked by
Akram
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Akram
Top achievements
Rank 1
Jeramy
Top achievements
Rank 1
Share this question
or