#1,027 – Displaying a Subrange on a Slider

You can highlight a sub-range on a Slider that is some subset of the full range.  You do this by setting the IsSelectionRangeEnabled property to true and setting SelectionStart and SelectionEnd to the desired start and end values for the range.  The sub-range is displayed using a different color.  Triangular indicators are displayed on the tickmark bar to show the start and end of the range.

Displaying a sub-range in this manner has no effect on the values that you’re allowed to pick with the Slider.  It’s merely a visual indicator.

        <Label Content="Set your Age.  (Subrange is typical working age)."/>
        <Slider Name="mySlider" Margin="10" Foreground="Blue"
                Minimum="0" Maximum="100"
                SelectionStart="22" SelectionEnd="65"
                TickFrequency="5" />
        <StackPanel Orientation="Horizontal">
            <Label Content="Value:" />
            <TextBlock Text="{Binding Value, ElementName=mySlider, StringFormat={}{0:0}}"



About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

3 Responses to #1,027 – Displaying a Subrange on a Slider

  1. Pingback: Dew Drop – March 12, 2014 (#1741) | Morning Dew

  2. Roger says:

    It would be great if you would continue the slider examples with a discussion if the TickBar. The example in Microsoft docs is equivalent of using an A-Bomb to kill a flea. In particular, there must be a a way to separate the tick frequency from allowed values. For example, I want a slider to display ticks every 4 integer from 1-24 but want the use to be able to pick any integer.

    Or are you not posting any more?

    • Sean says:

      I haven’t tried it, but you can probably control the discrete values allowed by playing around with what you bind the Value property to, independent of tick frequency. Unfortunately, I’m not doing new posts at this time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: