change Image on ColorPicker

6 posts, 1 answers
  1. Dennis
    Dennis avatar
    62 posts
    Member since:
    Oct 2007

    Posted 10 Aug 2009 Link to this post

    I would like to change the image on the ColorPicker to one that I provide (to the bucket "fill" image). Is this possible? It would be nice to have this image built into the control and then just specify Foreground/Background as a property to determine which image is to be displayed.
  2. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 11 Aug 2009 Link to this post

    Hello Dennis,

    You can customize the appearance of colorpicker button by using  ColorButtonStyle property.
    Please take a look at the following example:
    http://demos.telerik.com/silverlight/#ColorPicker/FirstLook

    I hope that this will help you. Please let us know if you have any other questions.

    Regards,
    Boryana
    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. DevCraft banner
  4. Dennis
    Dennis avatar
    62 posts
    Member since:
    Oct 2007

    Posted 11 Aug 2009 Link to this post

    I agree that this example looks like what I want to accomplish, but I am very confused by the static resource - it looks like you are hand drawing the "image". I just want to say image="paintbucket.png" and be done with it. Is there a way to simply assign a new image, or do I have to "draw" the image using the resources. I will admit to you that I am new to Silverlight.
  5. Answer
    Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 11 Aug 2009 Link to this post

    Hello Dennis,

    You can insert any xaml code there - including an Image element with the appropriate content. Just replace the Path elements with Images. Please let us know if you need more help on that.

    Greetings,
    Valentin.Stoychev
    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.
  6. Dennis
    Dennis avatar
    62 posts
    Member since:
    Oct 2007

    Posted 11 Aug 2009 Link to this post

    Thanks for the help. I was able to figure it out with the below style (in case someone else wants a quick example).

     
    <Style x:Key="StyleBackgroundColorButtonStyle" TargetType="Button">  
     
        <Setter Property="Template">  
     
            <Setter.Value> 
     
                <ControlTemplate TargetType="Button">  
                      
                    <Grid> 
                          
                        <Border x:Name="BackgroundGradient" BorderThickness="1" Background="Transparent">  
                              
                            <Grid> 
                                  
                                <Grid.RowDefinitions> 
                                      
                                    <RowDefinition Height="0.664*"></RowDefinition> 
                                      
                                    <RowDefinition Height="0.336*"></RowDefinition> 
                                      
                                </Grid.RowDefinitions> 
     
                                <Image Width="20" Height="20" Source="../../Images/Common20/BackgroundColorFill.png" ToolTipService.ToolTip="Background Color" /> 
     
                                <Rectangle Width="16" Fill="{TemplateBinding Background}" Height="4.232" Grid.Row="1" VerticalAlignment="Top"></Rectangle> 
     
                            </Grid> 
                              
                        </Border> 
                          
                          
                    </Grid> 
     
                </ControlTemplate> 
     
            </Setter.Value> 
     
        </Setter> 
     
    </Style> 
  7. Jugal
    Jugal avatar
    1 posts
    Member since:
    Jun 2012

    Posted 07 Sep 2011 Link to this post

    Thanks Dennis...
    It is what I needed.
Back to Top
DevCraft banner