Change Bubble color at run time

3 posts, 1 answers
  1. jason
    jason avatar
    28 posts
    Member since:
    Oct 2010

    Posted 13 Jun 2012 Link to this post

    I am trying to restyle the bubbles in a Bubble series so they look a little more 3-d.  I have accomplished this with a radial gradiant in this style here:

    <Style x:Key="CustomBubbleStyle" TargetType="chart:Bubble">
               <Setter Property="Template">
                       <ControlTemplate TargetType="chart:Bubble">
                           <Canvas >
                           <Ellipse x:Name="PART_BubbleElement"
                                 Canvas.Left="{TemplateBinding Left}"
                                 Canvas.Top="{TemplateBinding Top}"
                                 Width="{TemplateBinding Diameter}"
                                 Height="{TemplateBinding Diameter}"
                       <GradientStop Color="#FFF5F5F9"/>
                       <GradientStop Color="#FF091E8F" Offset="0.989"/>

    My problem is that in every example I have seen you have to set the colors at design time.  In out scenario I have built a control that extends the RadChart.  I have a dependency property which is a list of brushes. If that is set then I use those colors.  If not then I use your default colors.  I was thinking I could catch the item when the color is set and then change it to add a gradiant so it is the same color just with the gradient added but I can't seem to figure out if that is possible.  Something like setting the fill property to Bind to something in Bubble and then using a converter to add the gradient.  Is anything like this possible or do I just need to come up with new default colors on my own and do it that way?  Sorry if this does not make sense as I was having trouble figuring out how to explain it.  Thanks.
  2. Answer
    Sia avatar
    766 posts

    Posted 18 Jun 2012 Link to this post

    Hello Jason,

    Unfortunately in RadChart there is no easy way for getting the default colors in the way you need. That is why I can suggest you two possible solutions:
    • new default colors as you mentioned
    • or using universal gradient [black and white with transparency] which can be used on every bubble's fill. If you need help with this, please let me know.

    the Telerik team

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

  3. jason
    jason avatar
    28 posts
    Member since:
    Oct 2010

    Posted 18 Jun 2012 Link to this post

    I went ahead and just set a default color scheme using the colors from one of your themes.  Thanks.
Back to Top