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

Ability to lock handle?

8 Answers 58 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Nicole
Top achievements
Rank 1
Nicole asked on 14 Feb 2012, 09:32 PM
I am using a RadSlider to set the date range for a separate chart as follows:

<telerik:RadSlider x:Name="sldTimeSelection" Grid.Row="1" Grid.Column="0" Orientation="Horizontal"  
                   Minimum="-365" Maximum="0" IsMoveToPointEnabled="True"
                   IsSelectionRangeEnabled="True" MinimumRangeSpan="7" MaximumRangeSpan="365" 
                   SelectionStart="-30" SelectionEnd="0"
                   IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="-7, -30, -90, -180, -365" 
                                                    EnableSideTicks="False" Margin="5,0" >
</telerik:RadSlider>


Is there any way to lock the Increase Handle into it's position at 0?  We do not, at this time, wish to enable the customer to look at a range of historical data, but the customer likes the look of the rage versus the look of a single thumb selection.

I could ignore the increase handle value and reset it back to 0 in the event handler, but I don't think this would be user friendly and might cause frustration.

8 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 16 Feb 2012, 03:31 PM
Hi Nicole,

 Try setting the AlternateThumbStyle with an IsEnabled setter:

<telerik:RadSlider>
    <telerik:RadSlider.AlternateThumbStyle>
        <Style TargetType="Thumb">
            <Setter Property="IsEnabled" Value="False" />
        </Style>
    </telerik:RadSlider.AlternateThumbStyle>
</telerik:RadSlider>

Give it a try and let me know if this works for you.

Greetings,
Kiril Stanoev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Nicole
Top achievements
Rank 1
answered on 16 Feb 2012, 03:56 PM
Thanks for the idea, Kiril.  I get an error that "the attachable property 'AlternateThumbStyle' was not found in type RadSlider'

It looks like this was added in 2011.3, but we are on 2011.2.290.1040 and I am not allowed to upgrade versions.  Are you aware of a work-around for 2011.2?

0
Kiril Stanoev
Telerik team
answered on 16 Feb 2012, 05:20 PM
Hi Nicole,

In this case you will have to traverse the visual tree of RadSlider and find the desired thumb.

<telerik:RadSlider x:Name="slider1" Loaded="slider1_Loaded" IsSelectionRangeEnabled="True" />

private void slider1_Loaded(object sender, RoutedEventArgs e)
{
    this.Dispatcher.BeginInvoke(() =>
    {
        var selectionStartThumb = this.slider1.ChildrenOfType<Thumb>().Where(thumb => thumb.Name == "RangeStartThumb").FirstOrDefault();
        if (selectionStartThumb != null)
        {
            selectionStartThumb.IsEnabled = false;
        }
    });
}

Give it a try and let me know if it works. I'd be glad to further assist you.

Regards,
Kiril Stanoev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Nicole
Top achievements
Rank 1
answered on 16 Feb 2012, 07:51 PM
I modified this a bit to get rid of a "not a delegate type" error as follows:

this.Dispatcher.BeginInvoke((Action)(() =>
{
    var selectionStartThumb = this.sldTimeSelection.ChildrenOfType<Thumb>().Where(thumb => thumb.Name == "RangeStartThumb").FirstOrDefault();
    if (selectionStartThumb != null)
    {
        selectionStartThumb.IsEnabled = false;
    }
}));

However, I am still getting an error that "The type or namespace name 'Thumb' could not be found."  The project and .cs both reference Teleriks.Windows.Controls. 

Do I need another reference, or is the type maybe incorrect?  I don't see anything in intellisense that looks close.
0
Kiril Stanoev
Telerik team
answered on 17 Feb 2012, 01:06 PM
Hi Nicole,

 I am not sure what might be causing this issue, but it smells like it has something to do with namespaces. However I need more information because I am not sure what might be causing the issue.

Kind regards,
Kiril Stanoev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Nicole
Top achievements
Rank 1
answered on 21 Feb 2012, 01:48 PM
Hi Kiril,

What kind of information would help?  Here's my using section:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;
using Dashboard.Silverlight.SystemDetailsService;
using Telerik.Windows.Controls;
using Dashboard.Silverlight.SupportClasses;
using System.Windows.Browser;
using Telerik.Windows.Controls.GridView;
using Dashboard.Silverlight.Views.Aviation;
using Telerik.Windows.Controls.Charting;

0
Accepted
Kiril Stanoev
Telerik team
answered on 23 Feb 2012, 10:40 AM
Hello Nicole,

Could you please try the following approach and let me know if it helps.

this.Dispatcher.BeginInvoke((Action)(() =>
{
    var selectionStartThumb = this.sldTimeSelection.ChildrenOfType<System.Windows.Controls.Primitives.Thumb>().Where(thumb => thumb.Name == "RangeStartThumb").FirstOrDefault();
    if (selectionStartThumb != null)
    {
        selectionStartThumb.IsEnabled = false;
    }
}));
 

Regards,
Kiril Stanoev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Nicole
Top achievements
Rank 1
answered on 23 Feb 2012, 02:34 PM
Thanks, that works great.  It locked down the wrong thumb but I changed that easily.

this.Dispatcher.BeginInvoke((Action)(() =>
{
    var selectionEndThumb = this.sldTimeSelection.ChildrenOfType<System.Windows.Controls.Primitives.Thumb>().Where(thumb => thumb.Name == "RangeEndThumb").FirstOrDefault();
    if (selectionEndThumb != null)
    {
        selectionEndThumb.IsEnabled = false;
    }
}));
Tags
Slider
Asked by
Nicole
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Nicole
Top achievements
Rank 1
Share this question
or