Range Slider Thumb Color

3 posts, 0 answers
  1. Heather Kyle
    Heather Kyle avatar
    6 posts
    Member since:
    Oct 2009

    Posted 29 Jan 2010 Link to this post

    I am going to be adding a number of range sliders to a control, dynamically at runtime. Ideally, they will all have the same style, except for the thumb color. Is it possible to dynamically set the color of a Range Slider 'HorizontalRangeMiddleThumb' at run-time?
  2. Dimitrina
    Admin
    Dimitrina avatar
    442 posts

    Posted 01 Feb 2010 Link to this post

    Hello Heather Kyle,

    This functionality is not supported by the control.

    You can apply  a custom theme to RadSlider. For more information you can follow the link below:
    http://www.telerik.com/help/silverlight/radcontrols-for-silverlight-expression-blend-support.html

    If you have further  questions please do not hesitate to ask us.
    I hope this will help you.

    Best wishes,
    Dimitrina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Heather Kyle
    Heather Kyle avatar
    6 posts
    Member since:
    Oct 2009

    Posted 01 Feb 2010 Link to this post

    I actually found a fairly easy work-around for this problem. I set the background color for the thumb to a SolidColorBrush that was defined in the Control.Resources. I manipulate that color through a property in the code-behind, and voilà--the thumbs are the colors I want them to be.
    In the .xaml file:
    <Canvas.Resources> 
            <SolidColorBrush x:Key="BackgroundBrush" Color="DarkGray" /> 
    ... 
            <Border Background="{StaticResource BackgroundBrush}" /> 
    ... 
    </Canvas.Resources> 

    And in the .cs file:
    public Color BackgroundColor 
         set 
         { 
              if (this.Resources.Contains("BackgroundBrush")) 
              { 
                   object brush = this.Resources["BackgroundBrush"]; 
                   if (brush != null
                   (brush as SolidColorBrush).Color = value; 
              } 
         } 

Back to Top